X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fprocedures%2FCreateInverseRelations.java;h=21ccc1464de7ee82a154536c58b219d24af302ad;hb=c2ab38c94029486a379c79a7b38604f1c03afa44;hp=42ab8fde24f8f3cafb5f5a4a2c5d528f69befa95;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/CreateInverseRelations.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/CreateInverseRelations.java index 42ab8fde2..21ccc1464 100644 --- a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/CreateInverseRelations.java +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/CreateInverseRelations.java @@ -1,88 +1,88 @@ -package org.simantics.graph.compiler.internal.procedures; - -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.hash.TIntIntHashMap; - -import org.simantics.graph.query.IGraph; -import org.simantics.graph.query.Paths; -import org.simantics.graph.query.Res; -import org.simantics.graph.store.GraphStore; -import org.simantics.graph.store.StatementStore; - -public class CreateInverseRelations implements Runnable { - IGraph graph; - GraphStore store; - - public CreateInverseRelations(IGraph graph, GraphStore store) { - this.graph = graph; - this.store = store; - } - - @Override - public void run() { - Paths paths = graph.getPaths(); - int subrelationOf = store.identities.pathToId(paths.SubrelationOf); - if(subrelationOf < 0) - return; - - int inverseOf = store.identities.createPathToId(paths.InverseOf); - - int resourceCount = store.identities.getResourceCount(); - TIntIntHashMap inverseMap = new TIntIntHashMap(); - StatementStore statements = store.statements; - for(int id = 0;id= 0) { - invSuperrelations.set(i, - invSuperrelations.get(invSuperrelations.size()-1)); - invSuperrelations.removeAt(invSuperrelations.size()-1); - } - } - } - - for(int invSuperrelation : invSuperrelations.toArray()) - store.statements.add(inverse, subrelationOf, invSuperrelation); - } - } - } - } -} +package org.simantics.graph.compiler.internal.procedures; + +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.hash.TIntIntHashMap; + +import org.simantics.graph.query.IGraph; +import org.simantics.graph.query.Paths; +import org.simantics.graph.query.Res; +import org.simantics.graph.store.GraphStore; +import org.simantics.graph.store.StatementStore; + +public class CreateInverseRelations implements Runnable { + IGraph graph; + GraphStore store; + + public CreateInverseRelations(IGraph graph, GraphStore store) { + this.graph = graph; + this.store = store; + } + + @Override + public void run() { + Paths paths = graph.getPaths(); + int subrelationOf = store.identities.pathToId(paths.SubrelationOf); + if(subrelationOf < 0) + return; + + int inverseOf = store.identities.createPathToId(paths.InverseOf); + + int resourceCount = store.identities.getResourceCount(); + TIntIntHashMap inverseMap = new TIntIntHashMap(); + StatementStore statements = store.statements; + for(int id = 0;id= 0) { + invSuperrelations.set(i, + invSuperrelations.get(invSuperrelations.size()-1)); + invSuperrelations.removeAt(invSuperrelations.size()-1); + } + } + } + + for(int invSuperrelation : invSuperrelations.toArray()) + store.statements.add(inverse, subrelationOf, invSuperrelation); + } + } + } + } +}