From 01ff5098857b8e8117b76f59f79b13ace2ef2943 Mon Sep 17 00:00:00 2001 From: William Barker Date: Mon, 9 Feb 2009 12:41:20 +0000 Subject: [PATCH] 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 --- .../apache/commons/math/linear/SparseRealVector.java | 3 --- .../commons/math/util/OpenIntToDoubleHashMap.java | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/src/java/org/apache/commons/math/linear/SparseRealVector.java b/src/java/org/apache/commons/math/linear/SparseRealVector.java index 5686e8512..eb1a4b5b9 100644 --- a/src/java/org/apache/commons/math/linear/SparseRealVector.java +++ b/src/java/org/apache/commons/math/linear/SparseRealVector.java @@ -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)) diff --git a/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java b/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java index d4560e7e3..19a65f34f 100644 --- a/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java +++ b/src/java/org/apache/commons/math/util/OpenIntToDoubleHashMap.java @@ -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;