Added hashcode/equals methods to generic profile Group implementations 09/2609/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 21 Jan 2019 09:30:47 +0000 (11:30 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 21 Jan 2019 09:30:47 +0000 (11:30 +0200)
gitlab #247

Change-Id: I16603a738c7a43847a38e6007cd72cfcc268afd1

bundles/org.simantics.diagram/src/org/simantics/diagram/profile/DiagramElementGroup.java
bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/diagram/adapter/DiagramGroup.java

index cc04927f6ef7249c7cb5a33a0620db04f48b22d5..bcbe6c7c64032bc88b336e09c9c0c83dc10f1105 100644 (file)
@@ -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());
+    }
 
 }
index 8b19fd8e4f2d82c9705ab9856c03134bd621f2c6..3c2756a668723d7de6fe8e3b6350ebadf936ad55 100644 (file)
@@ -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<Resource> listener) {
                listener.add(runtimeDiagram);
        }
+       
+    @Override
+    public int hashCode() {
+        return this.getClass().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj.getClass().equals(this.getClass());
+    }
 
 }