X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fadapter%2FTypeGroup.java;h=b7b4ba2ff13bb9d9a55fec7a155bbc389bdd8883;hp=e025fb2ddf16927783a2fc353817b87c9c068155;hb=ab9fcfe016ef75da40eb00a46d4a54b50e534511;hpb=6c70e409e03187c96b057aa5705d49800c6b8b07 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java index e025fb2dd..b7b4ba2ff 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/TypeGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2018 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -39,7 +39,7 @@ public class TypeGroup implements Group { private final String name; public TypeGroup(String name, Resource type) { - this(name); + this(name, new Resource[] { type }); } public TypeGroup(String name, Resource... types) { @@ -47,6 +47,26 @@ public class TypeGroup implements Group { this.name = name; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + types.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; + TypeGroup other = (TypeGroup) obj; + return types.equals(other.types); + } + /** * Initialize TypeGroup from a DIAGRAM.Group instance. *