db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r264169 - /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java
Date Mon, 29 Aug 2005 17:05:30 GMT
Author: mbo
Date: Mon Aug 29 10:05:23 2005
New Revision: 264169

URL: http://svn.apache.org/viewcvs?rev=264169&view=rev
Log:
Remove EqualityHelper equals methods taking two arguments

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java?rev=264169&r1=264168&r2=264169&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java Mon Aug
29 10:05:23 2005
@@ -314,178 +314,6 @@
         return myList.equals(otherList);
     }
 
-    // Equality support methods
-
-    /** Returns <code>true</code> if the specified objects are equal. 
-     * This is a helper method checking for identical and <code>null</code>
-     * objects before delegating to the regular equals method.
-     * @param o1 one object to be tested for equality
-     * @param o2 the other object to be tested for equality
-     * @return <code>true</code> if the specified objects are equal.
-     */
-    public boolean equals(Object o1, Object o2) {
-        if (o1 == o2)
-            return true;
-        if ((o1 == null) || (o2 == null))
-            return false;
-        return o1.equals(o2);
-    }
-
-    /** Returns <code>true</code>, if compare called for the specified
-     * BigDecimal objects returns <code>0</code>. Please note, two
-     * BigDecimal instances are not equal (using equals) if their scale
-     * differs, and this method compares the values, ignoring scale. 
-     * @param bd1 one object to be tested for equality
-     * @param bd2 the other object to be tested for equality
-     * @return <code>true</code> if the specified BigDecimal objects are
-     * equal.
-     */
-    public boolean equals(BigDecimal bd1, BigDecimal bd2) {
-        if (bd1 == bd2)
-            return true;
-        if ((bd1 == null) || (bd2 == null))
-            return false;
-        return bd1.compareTo(bd2) == 0;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(boolean p1, boolean p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(char p1, char p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(byte p1, byte p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(short p1, short p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(int p1, int p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    /** Returns <code>true</code>, if two parameters are equal.  
-     * @param p1 one to be tested for equality
-     * @param p2 the other to be tested for equality
-     * @return <code>true</code> if the parameters are equal.
-     */
-    public boolean equals(long p1, long p2) {
-        if (p1 != p2) {
-            return false;
-        }
-        return true;
-    }
-
-    // Methods to support "close enough" comparison
-
-    /** Returns <code>true</code> if the specified objects are close
-     * enough to be considered to be equal for a deep equals
-     * comparison. The method delegates to the method taking double
-     * or float values if the specified objects are Float or Double
-     * wrappers. Otherwise it delegates to equals. 
-     * @param o1 one object to be tested for close enough 
-     * @param o2 the other object to be tested for close enough 
-     * @return <code>true</code> if the specified values are close enough.
-     */
-    public boolean closeEnough(Object o1, Object o2) {
-        if (o1 == o2)
-            return true;
-        if ((o1 == null) || (o2 == null))
-            return false;
-       
-        if ((o1 instanceof Double) && (o2 instanceof Double))
-            return closeEnough(((Double)o1).doubleValue(), 
-                               ((Double)o2).doubleValue()); 
-        else if ((o1 instanceof Float) && (o2 instanceof Float))
-            return closeEnough(((Float)o1).floatValue(), 
-                               ((Float)o2).floatValue()); 
-        else if ((o1 instanceof BigDecimal) && (o2 instanceof BigDecimal))
-            return ((BigDecimal)o1).compareTo((BigDecimal)o2) == 0;
-        else
-            return o1.equals(o2);
-    }
-
-    /** Returns <code>true</code> if the specified float values are close
-     * enough to be considered to be equal for a deep equals
-     * comparison. Floating point values are not exact, so comparing them
-     * using <code>==</code> might not return useful results. This method
-     * checks that both double values are within some percent of each
-     * other. 
-     * @param d1 one double to be tested for close enough 
-     * @param d2 the other double to be tested for close enough 
-     * @return <code>true</code> if the specified values are close enough.
-     */
-    public boolean closeEnough(double d1, double d2) {
-        if (d1 == d2)
-            return true;
-
-        double diff = Math.abs(d1 - d2);
-        return diff < Math.abs((d1 + d2) * DOUBLE_EPSILON);
-    }
-
-    /**
-     * Returns <code>true</code> if the specified float values are close
-     * enough to be considered to be equal for a deep equals
-     * comparison. Floating point values are not exact, so comparing them 
-     * using <code>==</code> might not return useful results. This method
-     * checks that both float values are within some percent of each
-     * other. 
-     * @param f1 one float to be tested for close enough 
-     * @param f2 the other float to be tested for close enough 
-     * @return <code>true</code> if the specified values are close enough.
-     */
-    public boolean closeEnough(float f1, float f2) {
-        if (f1 == f2)
-            return true;
-
-        float diff = Math.abs(f1 - f2);
-        return diff < Math.abs((f1 + f2) * FLOAT_EPSILON);
-    }
-
     // Deep equality support methods with logging
     
     public String getUnequalBuffer() {



Mime
View raw message