From: Antti Villberg Date: Thu, 30 Jan 2020 07:58:25 +0000 (+0200) Subject: Ordering of connections was not stable X-Git-Tag: v1.43.0~113 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=abb3266ece7493e9d17ab75cbdf05d699a509488;p=simantics%2Fplatform.git Ordering of connections was not stable gitlab #452 Change-Id: I05041db794780e153ab19a01187cd8ca392fdb77 --- diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java index c1f47624d..996efb196 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java @@ -17,10 +17,10 @@ import java.io.IOException; import java.lang.reflect.Array; import java.net.URL; import java.nio.charset.Charset; -import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.TreeMap; +import java.util.TreeSet; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicReference; @@ -564,11 +564,11 @@ public class VariableDebugger extends Composite { Class clazz = o.getClass(); if(o instanceof Connection) { Connection c = (Connection)o; - ArrayList result = new ArrayList(); + TreeSet rvis = new TreeSet<>(); for(VariableConnectionPointDescriptor v : c.getConnectionPointDescriptors(graph, null)) { - result.add(v.getRelativeRVI(graph, base)); + rvis.add(v.getRelativeRVI(graph, base)); } - return "c " + result.toString(); //$NON-NLS-1$ + return "c " + rvis.toString(); //$NON-NLS-1$ } else if (clazz.isArray()) { if(int[].class == clazz) { return Arrays.toString((int[])o); diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java index b19b17523..a2d9e5c12 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TreeMap; +import java.util.TreeSet; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; @@ -137,9 +138,13 @@ public class DumpOntologyStructure { if(property.getClassifications(graph).contains(StructuralResource2.URIs.ConnectionRelation)) { dump.append(property.getName(graph)); Connection c = property.getValue(graph); + TreeSet rvis = new TreeSet<>(); for(VariableConnectionPointDescriptor desc : c.getConnectionPointDescriptors(graph, null)) { + rvis.add(desc.getRelativeRVI(graph, v)); + } + for(String rvi : rvis) { dump.append(" "); - dump.append(desc.getRelativeRVI(graph, v)); + dump.append(rvi); } dump.append("\n"); }