From: jsimomaa Date: Tue, 18 Dec 2018 13:12:44 +0000 (+0200) Subject: Add hashCode and equals to AbstractExpressionCompilationRequest X-Git-Tag: v1.43.0~136^2~221 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=27cae6bcf184f7e27822886f5a7320f771913b71;p=simantics%2Fplatform.git Add hashCode and equals to AbstractExpressionCompilationRequest gitlab #239 Change-Id: I33940420ee95a52d14042bd6857be4950d878dbb --- diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java index 3a95f2530..28b10c896 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/AbstractExpressionCompilationRequest.java @@ -236,4 +236,9 @@ implements Read> { return graph.getPossibleRelatedValue(predicate, L0.RequiresValueType, Bindings.STRING); } + @Override + public abstract int hashCode(); + + @Override + public abstract boolean equals(Object obj); } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileResourceValueRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileResourceValueRequest.java index e56c3d5ce..cdc787d26 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileResourceValueRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileResourceValueRequest.java @@ -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; + } + + } diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileValueRequest.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileValueRequest.java index 11f3ad185..e0ed90a89 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileValueRequest.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/scl/CompileValueRequest.java @@ -129,4 +129,36 @@ public class CompileValueRequest extends AbstractExpressionCompilationRequest