X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FTransferableGraphConfiguration2.java;h=2203ecaeb6bd792635aa1648495f20c3b5f03956;hp=94c6084f294417efaa8b6232c2625e78c014e951;hb=22703b9675e377d3620fb5b9fe1e4c3adc18edc4;hpb=29a9155f55ac9ccaef1b3fd163e7c4230fcd4d1c diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TransferableGraphConfiguration2.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TransferableGraphConfiguration2.java index 94c6084f2..2203ecaeb 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TransferableGraphConfiguration2.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/TransferableGraphConfiguration2.java @@ -24,8 +24,16 @@ public class TransferableGraphConfiguration2 { public final Resource resource; public final String name; public final boolean internal; + /** + * Optional, may be null. + */ + public final String type; public RootSpec(Resource resource, String name, boolean internal) { + this(resource, name, internal, null); + } + + public RootSpec(Resource resource, String name, boolean internal, String type) { if (resource == null) throw new NullPointerException("null resource"); if (name == null) @@ -33,11 +41,12 @@ public class TransferableGraphConfiguration2 { this.resource = resource; this.name = name; this.internal = internal; + this.type = type; } @Override public String toString() { - return "RootSpec[" + name + ", " + resource + ", " + internal + "]"; + return "RootSpec[" + name + ", " + resource + ", " + internal + ", " + type + "]"; } @Override @@ -47,6 +56,7 @@ public class TransferableGraphConfiguration2 { result = prime * result + (internal ? 1231 : 1237); result = prime * result + resource.hashCode(); result = prime * result + name.hashCode(); + result = prime * result + (type != null ? type.hashCode() : 0); return result; } @@ -59,10 +69,18 @@ public class TransferableGraphConfiguration2 { if (getClass() != obj.getClass()) return false; RootSpec other = (RootSpec) obj; - return internal == other.internal && resource.equals(other.resource) && name.equals(other.name); + return internal == other.internal && resource.equals(other.resource) && name.equals(other.name) + && objectEquals(type, other.type); + } + + private boolean objectEquals(Object o1, Object o2) { + if (o1 == o2) return true; + if (o1 == null && o2 == null) return true; + if (o1 == null || o2 == null) return false; + return o1.equals(o2); } } - + final public TreeMap baseExtensions = new TreeMap(); final public Resource indexRoot; final public Collection roots;