remove eclipse generated equals since it doesn't work. Will add a working equals later
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@742837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
01ff509885
commit
01f82aed42
|
@ -1210,43 +1210,4 @@ public class SparseRealVector implements RealVector {
|
|||
return getData();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((entries == null) ? 0 : entries.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(epsilon);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + virtualSize;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof SparseRealVector))
|
||||
return false;
|
||||
SparseRealVector other = (SparseRealVector) obj;
|
||||
if (entries == null) {
|
||||
if (other.entries != null)
|
||||
return false;
|
||||
} else if (!entries.equals(other.entries)){
|
||||
return false;
|
||||
}if (Double.doubleToLongBits(epsilon) != Double
|
||||
.doubleToLongBits(other.epsilon))
|
||||
return false;
|
||||
if (virtualSize != other.virtualSize)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -595,49 +595,5 @@ public class OpenIntToDoubleHashMap implements Serializable {
|
|||
count = 0;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.hashCode(keys);
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(missingEntries);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + size;
|
||||
result = prime * result + Arrays.hashCode(states);
|
||||
result = prime * result + Arrays.hashCode(values);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
OpenIntToDoubleHashMap other = (OpenIntToDoubleHashMap) obj;
|
||||
if (!Arrays.equals(keys, other.keys))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(missingEntries) != Double
|
||||
.doubleToLongBits(other.missingEntries))
|
||||
return false;
|
||||
if (size != other.size)
|
||||
return false;
|
||||
if (!Arrays.equals(states, other.states)){
|
||||
return false;
|
||||
}
|
||||
if (!Arrays.equals(values, other.values)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1124,11 +1124,12 @@ public class SparseRealVectorTest extends TestCase {
|
|||
v.setEntry(1, 1);
|
||||
assertTrue(v.isInfinite());
|
||||
|
||||
//TODO: backing store doesn't implement equals
|
||||
//TODO: differeciate from resetting to zero
|
||||
//v.setEntry(0, 0);
|
||||
//assertEquals(v, new SparseRealVector(new double[] { 0, 1, 2 }));
|
||||
assertNotSame(v, new SparseRealVector(new double[] { 0, 1, 2 + Math.ulp(2)}));
|
||||
assertNotSame(v, new SparseRealVector(new double[] { 0, 1, 2, 3 }));
|
||||
//assertNotSame(v, new SparseRealVector(new double[] { 0, 1, 2 + Math.ulp(2)}));
|
||||
//assertNotSame(v, new SparseRealVector(new double[] { 0, 1, 2, 3 }));
|
||||
|
||||
//assertEquals(new SparseRealVector(new double[] { Double.NaN, 1, 2 }).hashCode(),
|
||||
// new SparseRealVector(new double[] { 0, Double.NaN, 2 }).hashCode());
|
||||
|
|
Loading…
Reference in New Issue