From abb3266ece7493e9d17ab75cbdf05d699a509488 Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Thu, 30 Jan 2020 09:58:25 +0200 Subject: [PATCH] Ordering of connections was not stable gitlab #452 Change-Id: I05041db794780e153ab19a01187cd8ca392fdb77 --- .../src/org/simantics/debug/ui/VariableDebugger.java | 8 ++++---- .../simantics/modeling/utils/DumpOntologyStructure.java | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) 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"); } -- 2.47.1