X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fprocedures%2FMergeEqualResources.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fprocedures%2FMergeEqualResources.java;h=17ebec994908180caf0f0f8468745b45ff4f98bd;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/MergeEqualResources.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/MergeEqualResources.java new file mode 100644 index 000000000..17ebec994 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/MergeEqualResources.java @@ -0,0 +1,38 @@ +package org.simantics.graph.compiler.internal.procedures; + +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.hash.TIntIntHashMap; + +import org.simantics.graph.query.Paths; +import org.simantics.graph.store.GraphStore; +import org.simantics.graph.store.IdentityStore; + +public class MergeEqualResources implements Runnable { + + GraphStore store; + Paths paths; + + public MergeEqualResources(Paths paths, GraphStore store) { + this.paths = paths; + this.store = store; + } + + @Override + public void run() { + IdentityStore identities = store.identities; + if(identities.contains(paths.Equals)) { + int equalsId = identities.pathToId(paths.Equals); + identities.removeIdentity(equalsId); + TIntArrayList rel = store.statements.extractRelation(equalsId); + for(int i=0;i