From: Marko Luukkainen Date: Mon, 21 Jan 2019 09:30:47 +0000 (+0200) Subject: Added hashcode/equals methods to generic profile Group implementations X-Git-Tag: v1.43.0~136^2~206^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=cb337ac8c87b7bdad11ffb8584f76610c51d3a75;p=simantics%2Fplatform.git Added hashcode/equals methods to generic profile Group implementations gitlab #247 Change-Id: I16603a738c7a43847a38e6007cd72cfcc268afd1 --- diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/DiagramElementGroup.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/DiagramElementGroup.java index cc04927f6..bcbe6c7c6 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/DiagramElementGroup.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/profile/DiagramElementGroup.java @@ -63,5 +63,15 @@ public abstract class DiagramElementGroup implements Group { } protected abstract boolean test(ReadGraph graph, Resource element) throws DatabaseException; + + @Override + public int hashCode() { + return this.getClass().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj.getClass().equals(this.getClass()); + } } diff --git a/bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/diagram/adapter/DiagramGroup.java b/bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/diagram/adapter/DiagramGroup.java index 8b19fd8e4..3c2756a66 100644 --- a/bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/diagram/adapter/DiagramGroup.java +++ b/bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/diagram/adapter/DiagramGroup.java @@ -20,7 +20,8 @@ import org.simantics.scenegraph.profile.Group; * @author Tuukka Lehtonen */ public class DiagramGroup implements Group { - + + @Override public String toString() { return "diagram"; @@ -30,6 +31,16 @@ public class DiagramGroup implements Group { public void trackItems(RequestProcessor processor, Resource runtimeDiagram, SetListener listener) { listener.add(runtimeDiagram); } + + @Override + public int hashCode() { + return this.getClass().hashCode(); + } + + @Override + public boolean equals(Object obj) { + return obj.getClass().equals(this.getClass()); + } }