You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bi...@apache.org on 2009/02/10 04:02:38 UTC
svn commit: r742837 - in /commons/proper/math/trunk/src:
java/org/apache/commons/math/linear/SparseRealVector.java
java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java
test/org/apache/commons/math/linear/SparseRealVectorTest.java
Author: billbarker
Date: Tue Feb 10 03:02:38 2009
New Revision: 742837
URL: http://svn.apache.org/viewvc?rev=742837&view=rev
Log:
remove eclipse generated equals since it doesn't work. Will add a working equals later
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
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealVectorTest.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=742837&r1=742836&r2=742837&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 Tue Feb 10 03:02:38 2009
@@ -1210,43 +1210,4 @@
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;
- }
}
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=742837&r1=742836&r2=742837&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 Tue Feb 10 03:02:38 2009
@@ -595,49 +595,5 @@
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;
- }
-
+
}
Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java?rev=742837&r1=742836&r2=742837&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java Tue Feb 10 03:02:38 2009
@@ -1124,11 +1124,12 @@
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());