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

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


Author: pag
Date: 2008-08-27 15:39:39 -0700 (Wed, 27 Aug 2008)
New Revision: 1186

Modified:
   trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateImpl.java
Log:
Now checking for equality using the timezone information as well

Modified: trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateImpl.java
===================================================================
--- trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateImpl.java	2008-08-27 22:39:10 UTC (rev 1185)
+++ trunk/src/jar/store-stringpool/java/org/mulgara/store/stringpool/xa/SPDateImpl.java	2008-08-27 22:39:39 UTC (rev 1186)
@@ -191,19 +191,26 @@
   }
 
 
-  /* from Object. */
-
+  /**
+   * Used for caching, so it cannot compare by value.
+   * @return The hashcode for this date with timezone.
+   */
   public int hashCode() {
-    return date.hashCode();
+    return date.hashCode() ^ timezoneOffset;
   }
 
 
+  /**
+   * @see java.lang.Object#equals(java.lang.Object)
+   * Used for caching, so it cannot compare by value.
+   */
   public boolean equals(Object obj) {
     // Check for null.
     if (obj == null) return false;
 
     try {
-      return date.equals(((SPDateImpl)obj).date);
+      SPDateImpl oDate = (SPDateImpl)obj;
+      return date.equals(oDate.date) && timezoneOffset == oDate.timezoneOffset;
     } catch (ClassCastException ex) {
       // obj was not an SPDateImpl.
       return false;




More information about the Mulgara-svn mailing list