harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r825514 - /harmony/enhanced/classlib/trunk/modules/text/src/main/java/org/apache/harmony/text/BidiRun.java
Date Thu, 15 Oct 2009 15:24:55 GMT
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;
     }
 }



Mime
View raw message