ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: Added hashCode() to OdbcColumnMeta.
Date Thu, 11 Feb 2016 13:24:08 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1786 07104c405 -> 70d5323b2


Added hashCode() to OdbcColumnMeta.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70d5323b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70d5323b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70d5323b

Branch: refs/heads/ignite-1786
Commit: 70d5323b2781f8966f155f06cd6dfae3cc9043ea
Parents: 07104c4
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Feb 11 16:24:05 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Feb 11 16:24:05 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/OdbcColumnMeta.java         | 28 +++++++++++++-------
 .../internal/processors/odbc/OdbcTableMeta.java | 11 ++++----
 2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/70d5323b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
index 5e1b862..757b24b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcColumnMeta.java
@@ -64,6 +64,7 @@ public class OdbcColumnMeta {
         this.columnName = info.fieldName();
 
         Class<?> type;
+
         try {
             type = Class.forName(info.fieldTypeName());
         }
@@ -75,17 +76,26 @@ public class OdbcColumnMeta {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean equals(Object o)
-    {
-        if (!(o instanceof OdbcColumnMeta))
-            return false;
+    @Override public int hashCode() {
+        int hash = schemaName.hashCode();
+
+        hash = 31 * hash + tableName.hashCode();
+        hash = 31 * hash + columnName.hashCode();
+        hash = 31 * hash + dataType.hashCode();
+
+        return hash;
+    }
 
-        OdbcColumnMeta another = (OdbcColumnMeta)o;
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (o instanceof OdbcColumnMeta) {
+            OdbcColumnMeta other = (OdbcColumnMeta) o;
+
+            return this == other || schemaName.equals(other.schemaName) && tableName.equals(other.tableName)
&&
+                columnName.equals(other.columnName) && dataType.equals(other.dataType);
+        }
 
-        return schemaName.equals(another.schemaName) &&
-               tableName.equals(another.tableName)   &&
-               columnName.equals(another.columnName) &&
-               dataType.equals(another.dataType);
+        return false;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/70d5323b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
index 775cd24..e7f762e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcTableMeta.java
@@ -63,13 +63,14 @@ public class OdbcTableMeta {
 
     /** {@inheritDoc} */
     @Override public boolean equals(Object o) {
-        if (!(o instanceof OdbcTableMeta))
-            return false;
+        if (o instanceof OdbcTableMeta) {
+            OdbcTableMeta other = (OdbcTableMeta) o;
 
-        OdbcTableMeta another = (OdbcTableMeta)o;
+            return this == other || catalog.equals(other.catalog) && schema.equals(other.schema)
&&
+                table.equals(other.table) && tableType.equals(other.tableType);
+        }
 
-        return catalog.equals(another.catalog) && schema.equals(another.schema) &&
table.equals(another.table) &&
-               tableType.equals(another.tableType);
+        return false;
     }
 
     /**


Mime
View raw message