You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/10/15 17:24:55 UTC

svn commit: r825514 - /harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java

Author: tellison
Date: Thu Oct 15 15:24:52 2009
New Revision: 825514

URL: http://svn.apache.org/viewvc?rev=825514&view=rev
Log:
Tidy-up equals() and implement a matching hashCode().

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java

Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java?rev=825514&r1=825513&r2=825514&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java Thu Oct 15 15:24:52 2009
@@ -47,9 +47,19 @@
 
     @Override
     public boolean equals(Object o) {
-        return o == null || o.getClass() != BidiRun.class ? false
-                : this.start == ((BidiRun) o).start
-                        && this.limit == ((BidiRun) o).limit
-                        && this.level == ((BidiRun) o).level;
+        if (o == null) {
+            return false;
+        }
+        if (!(o instanceof BidiRun)) {
+            return false;
+        }
+        BidiRun other = (BidiRun) o;
+        return start == other.start && limit == other.limit
+                && level == other.level;
+    }
+    
+    @Override
+    public int hashCode() {
+        return start ^ limit ^ level;
     }
 }