]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/scl/CompileStructuralValueRequest.java
Add missing relation field when computing hashCode/equals
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / scl / CompileStructuralValueRequest.java
index 3b54c0f62c871ceff88fa8ef5cc3ac4dbc95b955..6e9975b68ef09d2207438b728011640fa2f9efdc 100644 (file)
@@ -39,7 +39,7 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu
         Object oldGraph = sclContext.get("graph");
         CompileStructuralValueRequest request = new CompileStructuralValueRequest(graph, context);
         try {
-            Function1<Variable,Object> exp = graph.syncRequest(request, TransientCacheListener.<Function1<Variable,Object>>instance());
+            Function1<Object,Object> exp = graph.syncRequest(request, TransientCacheListener.instance());
             sclContext.put("graph", graph);
             return exp.apply(context);
         } catch (Throwable t) {
@@ -49,6 +49,10 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu
         }
     }
     
+    public static Function1<Object, Object> compile(ReadGraph graph, Resource s, Resource o, Resource p) throws DatabaseException {
+        return graph.syncRequest(new CompileStructuralValueRequest(s, o, p), TransientCacheListener.instance());
+    }
+    
     @Override
     protected String getExpressionText(ReadGraph graph)
             throws DatabaseException {
@@ -73,6 +77,7 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu
        public int hashCode() {
                final int prime = 31;
                int result = 1;
+               result = prime * result + ((relation == null) ? 0 : relation.hashCode());
                result = prime * result + ((component == null) ? 0 : component.hashCode());
                result = prime * result + ((literal == null) ? 0 : literal.hashCode());
                return result;
@@ -87,6 +92,11 @@ public class CompileStructuralValueRequest extends AbstractCompileStructuralValu
                if (getClass() != obj.getClass())
                        return false;
                CompileStructuralValueRequest other = (CompileStructuralValueRequest) obj;
+               if (relation == null) {
+                       if (other.relation != null)
+                               return false;
+               } else if (!relation.equals(other.relation))
+                       return false;
                if (component == null) {
                        if (other.component != null)
                                return false;