]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Ordering of connections was not stable 20/3820/2
authorAntti Villberg <antti.villberg@semantum.fi>
Thu, 30 Jan 2020 07:58:25 +0000 (09:58 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 30 Jan 2020 08:06:08 +0000 (08:06 +0000)
gitlab #452

Change-Id: I05041db794780e153ab19a01187cd8ca392fdb77

bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java
bundles/org.simantics.modeling/src/org/simantics/modeling/utils/DumpOntologyStructure.java

index c1f47624d7fa6d542ec5a6a9d14135b33a47ebda..996efb19626617aed12596a868762fd1dca91690 100644 (file)
@@ -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<String> result = new ArrayList<String>();
+            TreeSet<String> 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);
index b19b175238f00b415526c1d8a6c5e1b7e182613b..a2d9e5c1245695dfc1c23f38cb60009e9c1a492d 100644 (file)
@@ -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<String> 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");
                     }