[Mulgara-svn] r1187 - trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa

pag at mulgara.org pag at mulgara.org
Wed Aug 27 22:40:19 UTC 2008


Author: pag
Date: 2008-08-27 15:40:19 -0700 (Wed, 27 Aug 2008)
New Revision: 1187

Modified:
   trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDecimalImpl.java
Log:
Ensuring that equality is also by type

Modified: trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDecimalImpl.java
===================================================================
--- trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDecimalImpl.java	2008-08-27 22:39:39 UTC (rev 1186)
+++ trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDecimalImpl.java	2008-08-27 22:40:19 UTC (rev 1187)
@@ -351,7 +351,7 @@
     // The super will have returned a value already, but just in case we need to compare
     // values between different types, we convert.
     if (o instanceof SPDecimalBaseImpl) {
-      return -((SPDecimalBaseImpl)o).compareTo(this);
+      return BigDecimal.valueOf(l).compareTo(((SPDecimalBaseImpl)o).val);
     }
     // Compare the longs.
     SPDecimalExtImpl di = (SPDecimalExtImpl)o;
@@ -361,7 +361,7 @@
 
   /** @see java.lang.Object#hashCode() */
   public int hashCode() {
-    return (int)(l * 7) | (int)(l >> 32);
+    return (int)(l * 7) | (int)(l >> 32) ^ subtypeId;
   }
 
 
@@ -372,7 +372,7 @@
 
     try {
       SPDecimalExtImpl di = (SPDecimalExtImpl)obj;
-      return l == di.l;
+      return l == di.l && subtypeId == di.subtypeId;
     } catch (ClassCastException ex) {
       // obj was not an SPDecimalExtImpl.
       return false;




More information about the Mulgara-svn mailing list