Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 21316 invoked from network); 29 Aug 2005 17:32:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Aug 2005 17:32:11 -0000 Received: (qmail 479 invoked by uid 500); 29 Aug 2005 17:32:10 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 466 invoked by uid 99); 29 Aug 2005 17:32:10 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 29 Aug 2005 10:32:10 -0700 Received: (qmail 11938 invoked by uid 65534); 29 Aug 2005 17:05:30 -0000 Message-ID: <20050829170530.11937.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: jdo-commits@db.apache.org From: mbo@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 true if the specified objects are equal. - * This is a helper method checking for identical and null - * 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 true 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 true, if compare called for the specified - * BigDecimal objects returns 0. 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 true 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 true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true if the parameters are equal. - */ - public boolean equals(boolean p1, boolean p2) { - if (p1 != p2) { - return false; - } - return true; - } - - /** Returns true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true if the parameters are equal. - */ - public boolean equals(char p1, char p2) { - if (p1 != p2) { - return false; - } - return true; - } - - /** Returns true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true if the parameters are equal. - */ - public boolean equals(byte p1, byte p2) { - if (p1 != p2) { - return false; - } - return true; - } - - /** Returns true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true if the parameters are equal. - */ - public boolean equals(short p1, short p2) { - if (p1 != p2) { - return false; - } - return true; - } - - /** Returns true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true if the parameters are equal. - */ - public boolean equals(int p1, int p2) { - if (p1 != p2) { - return false; - } - return true; - } - - /** Returns true, if two parameters are equal. - * @param p1 one to be tested for equality - * @param p2 the other to be tested for equality - * @return true 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 true 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 true 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 true 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 == 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 true 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 true 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 == 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 true 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() {