Author: billbarker
Date: Mon Feb 9 12:41:20 2009
New Revision: 742445
URL: http://svn.apache.org/viewvc?rev=742445&view=rev
Log:
Fis some problems with equals for OpenInttoDoubleHashmap.
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java
commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java?rev=742445&r1=742444&r2=742445&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/SparseRealVector.java
Mon Feb 9 12:41:20 2009
@@ -1230,20 +1230,17 @@
*/
@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))
Modified:
commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java?rev=742445&r1=742444&r2=742445&view=diff
==============================================================================
---
commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
(original)
+++
commons/proper/math/trunk/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
Mon Feb 9 12:41:20 2009
@@ -603,7 +603,6 @@
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 @@
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;