From cb337ac8c87b7bdad11ffb8584f76610c51d3a75 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Mon, 21 Jan 2019 11:30:47 +0200 Subject: [PATCH] Added hashcode/equals methods to generic profile Group implementations gitlab #247 Change-Id: I16603a738c7a43847a38e6007cd72cfcc268afd1 --- .../diagram/profile/DiagramElementGroup.java | 10 ++++++++++ .../template2d/ui/diagram/adapter/DiagramGroup.java | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) 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()); + } } -- 2.47.1