Fis some problems with equals for OpenInttoDoubleHashmap.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@742445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d4f6893f9
commit
01ff509885
|
@ -1230,20 +1230,17 @@ public class SparseRealVector implements RealVector {
|
|||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
System.out.println("Checking equality of "+obj);
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (!(obj instanceof SparseRealVector))
|
||||
return false;
|
||||
System.out.println("is a sparse vector");
|
||||
SparseRealVector other = (SparseRealVector) obj;
|
||||
if (entries == null) {
|
||||
if (other.entries != null)
|
||||
return false;
|
||||
} else if (!entries.equals(other.entries)){
|
||||
System.out.println("no entries match");
|
||||
return false;
|
||||
}if (Double.doubleToLongBits(epsilon) != Double
|
||||
.doubleToLongBits(other.epsilon))
|
||||
|
|
|
@ -603,7 +603,6 @@ public class OpenIntToDoubleHashMap implements Serializable {
|
|||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + Arrays.hashCode(keys);
|
||||
result = prime * result + mask;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(missingEntries);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
|
@ -627,26 +626,15 @@ public class OpenIntToDoubleHashMap implements Serializable {
|
|||
OpenIntToDoubleHashMap other = (OpenIntToDoubleHashMap) obj;
|
||||
if (!Arrays.equals(keys, other.keys))
|
||||
return false;
|
||||
if (mask != other.mask)
|
||||
return false;
|
||||
if (Double.doubleToLongBits(missingEntries) != Double
|
||||
.doubleToLongBits(other.missingEntries))
|
||||
return false;
|
||||
if (size != other.size)
|
||||
return false;
|
||||
if (!Arrays.equals(states, other.states)){
|
||||
System.out.println("states not match:" );
|
||||
for(byte e : states){
|
||||
System.out.print(e+" ");
|
||||
}
|
||||
System.out.println();
|
||||
for(byte e : other.states){
|
||||
System.out.print(e+" ");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!Arrays.equals(values, other.values)){
|
||||
System.out.println("values don't match");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue