From 01f82aed424f2cd0c8dc2e0706dd2d810fc25de6 Mon Sep 17 00:00:00 2001 From: William Barker Date: Tue, 10 Feb 2009 03:02:38 +0000 Subject: [PATCH] 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 --- .../commons/math/linear/SparseRealVector.java | 39 ---------------- .../math/util/OpenIntToDoubleHashMap.java | 46 +------------------ .../math/linear/SparseRealVectorTest.java | 5 +- 3 files changed, 4 insertions(+), 86 deletions(-) diff --git a/src/java/org/apache/commons/math/linear/SparseRealVector.java b/src/java/org/apache/commons/math/linear/SparseRealVector.java index eb1a4b5b9..a8aecd5a9 100644 --- a/src/java/org/apache/commons/math/linear/SparseRealVector.java +++ b/src/java/org/apache/commons/math/linear/SparseRealVector.java @@ -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; - } } diff --git a/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java b/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java index 19a65f34f..9fdf27c9e 100644 --- a/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java +++ b/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java @@ -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; - } - + } diff --git a/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java b/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java index 098d9df97..fee502217 100644 --- a/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java +++ b/src/test/org/apache/commons/math/linear/SparseRealVectorTest.java @@ -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());