incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1207794 - in /incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog: common/ tablestore/
Date Tue, 29 Nov 2011 08:57:24 GMT
Author: kwright
Date: Tue Nov 29 08:57:22 2011
New Revision: 1207794

URL: http://svn.apache.org/viewvc?rev=1207794&view=rev
Log:
Start adding standard hash/equals methods to all keys and values, so I can do a performance
experiment

Modified:
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/BooleanValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterArray.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/IntegerValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringArray.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringValue.java
    incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/BooleanValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/BooleanValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/BooleanValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/BooleanValue.java
Tue Nov 29 08:57:22 2011
@@ -61,7 +61,7 @@ public class BooleanValue implements WHV
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof BooleanValue))
+    if (this.getClass() != o.getClass())
       return false;
     return ((BooleanValue)o).value == value;
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterArray.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterArray.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterArray.java
Tue Nov 29 08:57:22 2011
@@ -72,7 +72,7 @@ public class CharacterArray implements W
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof CharacterArray))
+    if (this.getClass() != o.getClass())
       return false;
     CharacterArray sa = (CharacterArray)o;
     if (sa.value.length != value.length)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/CharacterValue.java
Tue Nov 29 08:57:22 2011
@@ -62,7 +62,7 @@ public class CharacterValue implements W
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof CharacterValue))
+    if (this.getClass() != o.getClass())
       return false;
     return ((CharacterValue)o).value == value;
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/IntegerValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/IntegerValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/IntegerValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/IntegerValue.java
Tue Nov 29 08:57:22 2011
@@ -63,7 +63,7 @@ public class IntegerValue implements WHV
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof IntegerValue))
+    if (this.getClass() != o.getClass())
       return false;
     return ((IntegerValue)o).value == value;
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongArray.java
Tue Nov 29 08:57:22 2011
@@ -72,7 +72,7 @@ public class LongArray implements WHValu
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof LongArray))
+    if (this.getClass() != o.getClass())
       return false;
     LongArray sa = (LongArray)o;
     if (sa.value.length != value.length)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/LongValue.java
Tue Nov 29 08:57:22 2011
@@ -63,7 +63,7 @@ public class LongValue implements WHValu
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof LongValue))
+    if (this.getClass() != o.getClass())
       return false;
     return ((LongValue)o).value == value;
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringArray.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringArray.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringArray.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringArray.java
Tue Nov 29 08:57:22 2011
@@ -68,7 +68,7 @@ public class StringArray implements WHVa
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof StringArray))
+    if (this.getClass() != o.getClass())
       return false;
     StringArray sa = (StringArray)o;
     if (sa.value.length != value.length)

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/common/StringValue.java
Tue Nov 29 08:57:22 2011
@@ -63,7 +63,7 @@ public class StringValue implements WHVa
   
   public boolean equals(Object o)
   {
-    if (!(o instanceof StringValue))
+    if (this.getClass() != o.getClass())
       return false;
     return ((StringValue)o).value.equals(value);
   }

Modified: incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java?rev=1207794&r1=1207793&r2=1207794&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-286/warthog/src/main/java/org/apache/warthog/tablestore/IndexValue.java
Tue Nov 29 08:57:22 2011
@@ -91,4 +91,28 @@ public class IndexValue implements WHVal
   {
     return unique;
   }
+  
+  public int hashCode()
+  {
+    int rval = ((int)((tableID << 5) ^ (tableID >> 3)));
+    for (int i = 0 ; i < columnNames.length ; i++)
+    {
+      rval += columnNames[i].hashCode();
+      rval += comparatorClassNames[i].hashCode();
+    }
+    rval += (unique?87245:31);
+    return rval;
+  }
+  
+  public boolean equals(Object o)
+  {
+    if (this.getClass() != o.getClass())
+      return false;
+    IndexValue other = (IndexValue)o;
+    return other.tableID == tableID &&
+      StringArray.compareObject(other.columnNames,this.columnNames) &&
+      StringArray.compareObject(other.comparatorClassNames,this.comparatorClassNames) &&
+      other.unique == this.unique;
+  }
+  
 }



Mime
View raw message