]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileProceduralExpressionValueRequest.java
Add hashCode and equals to AbstractExpressionCompilationRequest
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / scl / CompileProceduralExpressionValueRequest.java
index fa0676e7d788748283b2059dcb00504e33106711..b402520d74cbe0bb5487e2d96ed15c35c8196af6 100644 (file)
@@ -31,8 +31,8 @@ public class CompileProceduralExpressionValueRequest extends AbstractCompileStru
         SCLContext sclContext = SCLContext.getCurrent();
         Object oldGraph = sclContext.get("graph");
         try {
-            Function1<Variable,Object> exp = graph.syncRequest(new CompileProceduralExpressionValueRequest(graph, expression, context),
-                    TransientCacheListener.<Function1<Variable,Object>>instance());
+            Function1<Object,Object> exp = graph.syncRequest(new CompileProceduralExpressionValueRequest(graph, expression, context),
+                    TransientCacheListener.instance());
             sclContext.put("graph", graph);
             return exp.apply(context);
         } catch (DatabaseException e) {
@@ -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;
+    }
+
+    
 }