]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Add hashCode and equals to AbstractExpressionCompilationRequest 63/2563/2
authorjsimomaa <jani.simomaa@gmail.com>
Tue, 18 Dec 2018 13:12:44 +0000 (15:12 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 18 Dec 2018 13:50:48 +0000 (13:50 +0000)
gitlab #239

Change-Id: I33940420ee95a52d14042bd6857be4950d878dbb

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileResourceValueRequest.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileValueRequest.java
bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java

index 3a95f25304f78248cde70c51fdd4eb127ff39d9c..28b10c896b2f2a99125964482343031e8eb1810e 100644 (file)
@@ -236,4 +236,9 @@ implements Read<Function1<EvaluationContext,Object>> {
         return graph.getPossibleRelatedValue(predicate, L0.RequiresValueType, Bindings.STRING);
     }
 
+    @Override
+    public abstract int hashCode();
+
+    @Override
+    public abstract boolean equals(Object obj);
 }
index e56c3d5cef0bf33b02be0a7a723cdf9c80c63064..cdc787d2683a135985244b31414379a0ac45d791 100644 (file)
@@ -110,4 +110,30 @@ public class CompileResourceValueRequest extends AbstractExpressionCompilationRe
             return null;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((literal == null) ? 0 : literal.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        CompileResourceValueRequest other = (CompileResourceValueRequest) obj;
+        if (literal == null) {
+            if (other.literal != null)
+                return false;
+        } else if (!literal.equals(other.literal))
+            return false;
+        return true;
+    }
+
+    
 }
index 11f3ad1854b29e28dbc9724a7149d489b508e310..e0ed90a8977472ed5061c784e42f1c3e7519282b 100644 (file)
@@ -129,4 +129,36 @@ public class CompileValueRequest extends AbstractExpressionCompilationRequest<Co
             return null;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((literal == null) ? 0 : literal.hashCode());
+        result = prime * result + ((relation == null) ? 0 : relation.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        CompileValueRequest other = (CompileValueRequest) obj;
+        if (literal == null) {
+            if (other.literal != null)
+                return false;
+        } else if (!literal.equals(other.literal))
+            return false;
+        if (relation == null) {
+            if (other.relation != null)
+                return false;
+        } else if (!relation.equals(other.relation))
+            return false;
+        return true;
+    }
+
+
 }
index d9ce13d5969c653a3932c486ea2dc3009b21fa8b..b402520d74cbe0bb5487e2d96ed15c35c8196af6 100644 (file)
@@ -59,4 +59,42 @@ public class CompileProceduralExpressionValueRequest extends AbstractCompileStru
        return componentType;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((componentType == null) ? 0 : componentType.hashCode());
+        result = prime * result + ((expression == null) ? 0 : expression.hashCode());
+        result = prime * result + ((indexRoot == null) ? 0 : indexRoot.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        CompileProceduralExpressionValueRequest other = (CompileProceduralExpressionValueRequest) obj;
+        if (componentType == null) {
+            if (other.componentType != null)
+                return false;
+        } else if (!componentType.equals(other.componentType))
+            return false;
+        if (expression == null) {
+            if (other.expression != null)
+                return false;
+        } else if (!expression.equals(other.expression))
+            return false;
+        if (indexRoot == null) {
+            if (other.indexRoot != null)
+                return false;
+        } else if (!indexRoot.equals(other.indexRoot))
+            return false;
+        return true;
+    }
+
+    
 }