You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2015/11/03 16:49:15 UTC

[02/13] oodt git commit: Addhashcodes

Addhashcodes


Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/3b03afc6
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/3b03afc6
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/3b03afc6

Branch: refs/heads/master
Commit: 3b03afc6e91d2c4cd050839480dd1411d171dda8
Parents: 0979eb3
Author: Tom Barber <to...@analytical-labs.com>
Authored: Mon Nov 2 20:30:38 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Mon Nov 2 20:30:38 2015 +0000

----------------------------------------------------------------------
 .../apache/oodt/cas/workflow/gui/util/Line.java |  6 +++++
 .../cas/cli/option/CmdLineOptionInstance.java   | 16 +++++++----
 .../oodt/commons/filter/ObjectTimeEvent.java    |  4 +++
 .../apache/oodt/commons/filter/TimeEvent.java   | 13 ++++++++-
 .../commons/filter/TimeEventWeightedHash.java   | 28 ++++++++++++++++++++
 .../cas/filemgr/structs/query/QueryResult.java  | 16 ++++++++---
 .../structs/query/filter/ObjectTimeEvent.java   |  4 +++
 .../filemgr/structs/query/filter/TimeEvent.java | 13 ++++++++-
 .../org/apache/oodt/cas/metadata/Metadata.java  |  4 +++
 .../pushpull/filerestrictions/VirtualFile.java  | 12 +++++++++
 .../cas/pushpull/protocol/ProtocolPath.java     |  8 ++++++
 .../oodt/cas/pushpull/protocol/RemoteSite.java  | 11 ++++++++
 .../cas/workflow/lifecycle/WorkflowState.java   | 12 ++++++++-
 .../org/apache/oodt/xmlquery/QueryResult.java   | 12 ++++++---
 14 files changed, 143 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
index 6e9796b..69d5fd3 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
@@ -70,4 +70,10 @@ public class Line {
     return this.fromModel.getModelId() + " -> " + this.toModel.getModelId();
   }
 
+  @Override
+  public int hashCode() {
+    int result = fromModel != null ? fromModel.hashCode() : 0;
+    result = 31 * result + (toModel != null ? toModel.hashCode() : 0);
+    return result;
+  }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/cli/src/main/java/org/apache/oodt/cas/cli/option/CmdLineOptionInstance.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/oodt/cas/cli/option/CmdLineOptionInstance.java b/cli/src/main/java/org/apache/oodt/cas/cli/option/CmdLineOptionInstance.java
index eefd697..c7b0b62 100755
--- a/cli/src/main/java/org/apache/oodt/cas/cli/option/CmdLineOptionInstance.java
+++ b/cli/src/main/java/org/apache/oodt/cas/cli/option/CmdLineOptionInstance.java
@@ -17,18 +17,16 @@
 package org.apache.oodt.cas.cli.option;
 
 //JDK imports
-import static org.apache.oodt.cas.cli.util.CmdLineUtils.isActionOption;
-import static org.apache.oodt.cas.cli.util.CmdLineUtils.isGroupOption;
-import static org.apache.oodt.cas.cli.util.CmdLineUtils.isHelpOption;
-import static org.apache.oodt.cas.cli.util.CmdLineUtils.isPrintSupportedActionsOption;
+import org.apache.commons.lang.Validate;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static org.apache.oodt.cas.cli.util.CmdLineUtils.*;
+
 //Apache imports
-import org.apache.commons.lang.Validate;
 
 /**
  * A specified {@link CmdLineOption} with its specified argument values.
@@ -133,6 +131,14 @@ public class CmdLineOptionInstance {
       }
    }
 
+   @Override
+   public int hashCode() {
+      int result = option != null ? option.hashCode() : 0;
+      result = 31 * result + (values != null ? values.hashCode() : 0);
+      result = 31 * result + (subOptions != null ? subOptions.hashCode() : 0);
+      return result;
+   }
+
    public String toString() {
       return "[option= " + option + ",values=" + values + ",subOptions="
             + subOptions + "]";

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java b/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
index ec6413f..6933f64 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
@@ -59,4 +59,8 @@ public class ObjectTimeEvent<objType> extends TimeEvent {
         return super.toString() + " - " + timeObj;
     }
 
+    @Override
+    public int hashCode() {
+        return timeObj != null ? timeObj.hashCode() : 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
index d4a73d0..106d06e 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
@@ -99,5 +99,16 @@ public class TimeEvent implements Comparable<TimeEvent> {
         Arrays.sort(eventsArray);
         return Arrays.asList(eventsArray);
     }
-    
+
+    @Override
+    public int hashCode() {
+        int result;
+        long temp;
+        result = (int) (startTime ^ (startTime >>> 32));
+        result = 31 * result + (int) (endTime ^ (endTime >>> 32));
+        result = 31 * result + (int) (dur ^ (dur >>> 32));
+        temp = Double.doubleToLongBits(priority);
+        result = 31 * result + (int) (temp ^ (temp >>> 32));
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
index c0d33a9..e95a3ab 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
@@ -402,4 +402,32 @@ public class TimeEventWeightedHash {
       return output;
   }
 
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        TimeEventWeightedHash that = (TimeEventWeightedHash) o;
+
+        if (epsilon != that.epsilon) {
+            return false;
+        }
+        if (root != null ? !root.equals(that.root) : that.root != null) {
+            return false;
+        }
+        return !(leafNodes != null ? !leafNodes.equals(that.leafNodes) : that.leafNodes != null);
+
+    }
+
+    @Override
+    public int hashCode() {
+        int result = root != null ? root.hashCode() : 0;
+        result = 31 * result + (int) (epsilon ^ (epsilon >>> 32));
+        result = 31 * result + (leafNodes != null ? leafNodes.hashCode() : 0);
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
index 190e6a5..60efb1a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
@@ -18,14 +18,15 @@
 package org.apache.oodt.cas.filemgr.structs.query;
 
 //JDK imports
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.oodt.cas.filemgr.structs.Product;
+import org.apache.oodt.cas.metadata.Metadata;
 
 import org.springframework.util.StringUtils;
 
+import java.util.ArrayList;
+import java.util.List;
+
 //OODT imports
-import org.apache.oodt.cas.filemgr.structs.Product;
-import org.apache.oodt.cas.metadata.Metadata;
 
 /**
  * 
@@ -131,4 +132,11 @@ public class QueryResult {
       return true;
     }
 
+  @Override
+  public int hashCode() {
+    int result = product != null ? product.hashCode() : 0;
+    result = 31 * result + (metadata != null ? metadata.hashCode() : 0);
+    result = 31 * result + (toStringFormat != null ? toStringFormat.hashCode() : 0);
+    return result;
+  }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
index b429f5f..16d7381 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
@@ -56,4 +56,8 @@ public class ObjectTimeEvent<objType> extends TimeEvent {
         return super.toString() + " - " + timeObj;
     }
 
+    @Override
+    public int hashCode() {
+        return timeObj != null ? timeObj.hashCode() : 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
index dec2f9c..912030a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
@@ -85,5 +85,16 @@ public class TimeEvent implements Comparable<TimeEvent> {
     public int compareTo(TimeEvent te) {
         return new Long(this.startTime).compareTo(te.startTime);
     }
-    
+
+    @Override
+    public int hashCode() {
+        int result;
+        long temp;
+        result = (int) (startTime ^ (startTime >>> 32));
+        result = 31 * result + (int) (endTime ^ (endTime >>> 32));
+        result = 31 * result + (int) (dur ^ (dur >>> 32));
+        temp = Double.doubleToLongBits(priority);
+        result = 31 * result + (int) (temp ^ (temp >>> 32));
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
index e432dfb..3d3d74a 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
@@ -602,4 +602,8 @@ public class Metadata {
     }
   }
 
+  @Override
+  public int hashCode() {
+    return root != null ? root.hashCode() : 0;
+  }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
index 8c30779..ce22854 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
@@ -302,4 +302,16 @@ public class VirtualFile {
         return output;
     }
 
+    @Override
+    public int hashCode() {
+        int result = regExp != null ? regExp.hashCode() : 0;
+        result = 31 * result + (children != null ? children.hashCode() : 0);
+        result = 31 * result + (parent != null ? parent.hashCode() : 0);
+        result = 31 * result + (noDirs ? 1 : 0);
+        result = 31 * result + (noFiles ? 1 : 0);
+        result = 31 * result + (isDir ? 1 : 0);
+        result = 31 * result + (allowNewFiles ? 1 : 0);
+        result = 31 * result + (allowNewDirs ? 1 : 0);
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
index b0a8944..9da66db 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
@@ -131,4 +131,12 @@ public class ProtocolPath implements Serializable {
         return new ProtocolPath(path.substring(0, path.lastIndexOf("/")), true);
     }
 
+    @Override
+    public int hashCode() {
+        int result = path != null ? path.hashCode() : 0;
+        result = 31 * result + (remotePath != null ? remotePath.hashCode() : 0);
+        result = 31 * result + (relativeToHOME ? 1 : 0);
+        result = 31 * result + (isDir ? 1 : 0);
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
index 76e2779..a443c6e 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/RemoteSite.java
@@ -115,4 +115,15 @@ public class RemoteSite {
                 + "'  username = '" + this.username + "' cdTestDir = '" 
                 + this.cdTestDir + "' maxConnections = '" + this.maxConnections + "'";
     }
+
+    @Override
+    public int hashCode() {
+        int result = alias != null ? alias.hashCode() : 0;
+        result = 31 * result + (username != null ? username.hashCode() : 0);
+        result = 31 * result + (password != null ? password.hashCode() : 0);
+        result = 31 * result + (cdTestDir != null ? cdTestDir.hashCode() : 0);
+        result = 31 * result + maxConnections;
+        result = 31 * result + (url != null ? url.hashCode() : 0);
+        return result;
+    }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
index 1f0d5ac..28a778f 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
@@ -136,5 +136,15 @@ public class WorkflowState {
   public void setPrevState(WorkflowState prevState) {
     this.prevState = prevState;
   }
-	
+
+  @Override
+  public int hashCode() {
+	int result = name != null ? name.hashCode() : 0;
+	result = 31 * result + (description != null ? description.hashCode() : 0);
+	result = 31 * result + (message != null ? message.hashCode() : 0);
+	result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
+	result = 31 * result + (category != null ? category.hashCode() : 0);
+	result = 31 * result + (prevState != null ? prevState.hashCode() : 0);
+	return result;
+  }
 }

http://git-wip-us.apache.org/repos/asf/oodt/blob/3b03afc6/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
index 595dbc8..81569ba 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
@@ -18,17 +18,19 @@
 
 package org.apache.oodt.xmlquery;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.oodt.product.Retriever;
 import org.apache.oodt.commons.util.Documentable;
+import org.apache.oodt.product.Retriever;
+
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Results of a query.
  *
@@ -144,4 +146,6 @@ public class QueryResult implements Serializable, Cloneable, Documentable {
 
 	/** Serial version unique ID. */
 	static final long serialVersionUID = 9156030927051226848L;
+
+
 }