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%2FConvertPreValues.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fprocedures%2FConvertPreValues.java;h=e7b80409af589f75d5a577d05f096151b61960a3;hp=ca1588ff079993835939446c3f7ba50ef1f729d9;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/ConvertPreValues.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/ConvertPreValues.java index ca1588ff0..e7b80409a 100644 --- a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/ConvertPreValues.java +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/procedures/ConvertPreValues.java @@ -1,80 +1,80 @@ -package org.simantics.graph.compiler.internal.procedures; - -import gnu.trove.list.array.TIntArrayList; -import gnu.trove.map.hash.TIntObjectHashMap; - -import java.util.Collection; - -import org.simantics.databoard.Bindings; -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.type.Datatype; -import org.simantics.graph.compiler.internal.store.PreValueStore; -import org.simantics.graph.query.IDataTypeQuery; -import org.simantics.graph.query.IGraph; -import org.simantics.graph.query.Paths; -import org.simantics.graph.store.GraphStore; -import org.simantics.graph.store.StatementStore; -import org.simantics.graph.store.ValueStore; -import org.simantics.ltk.Problem; - -public class ConvertPreValues implements Runnable { - - IGraph cg; - GraphStore store; - Collection problems; - - public ConvertPreValues(IGraph cg, GraphStore store, - Collection problems) { - this.cg = cg; - this.store = store; - this.problems = problems; - } - - @Override - public void run() { - PreValueStore preValues = store.getStore(PreValueStore.class); - preValues.convertPreValues(store.values, new IDataTypeQuery() { - - Paths paths = cg.getPaths(); - StatementStore statements = store.statements; - ValueStore values = store.values; - int HasDatatype = store.identities.createPathToId(paths.HasDatatype); - int InstanceOf = store.identities.createPathToId(paths.InstanceOf); - - @Override - public Binding getDataType(int id) { - TIntArrayList objects = statements.getObjects(id, HasDatatype); - if(objects.isEmpty()) { - objects = statements.getObjects(id, InstanceOf); - for(int i=0;i typeBindingCache = new TIntObjectHashMap(); - private Binding getDatatypeForType(int type) { - if(typeBindingCache.containsKey(type)) - return typeBindingCache.get(type); - else { - Datatype dt = cg.getAssertedDatatype(store.idToRes(type)); - Binding binding = dt == null ? null : Bindings.getBinding(dt); - typeBindingCache.put(type, binding); - return binding; - } - } - }, problems); - } - -} +package org.simantics.graph.compiler.internal.procedures; + +import gnu.trove.list.array.TIntArrayList; +import gnu.trove.map.hash.TIntObjectHashMap; + +import java.util.Collection; + +import org.simantics.databoard.Bindings; +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.type.Datatype; +import org.simantics.graph.compiler.internal.store.PreValueStore; +import org.simantics.graph.query.IDataTypeQuery; +import org.simantics.graph.query.IGraph; +import org.simantics.graph.query.Paths; +import org.simantics.graph.store.GraphStore; +import org.simantics.graph.store.StatementStore; +import org.simantics.graph.store.ValueStore; +import org.simantics.ltk.Problem; + +public class ConvertPreValues implements Runnable { + + IGraph cg; + GraphStore store; + Collection problems; + + public ConvertPreValues(IGraph cg, GraphStore store, + Collection problems) { + this.cg = cg; + this.store = store; + this.problems = problems; + } + + @Override + public void run() { + PreValueStore preValues = store.getStore(PreValueStore.class); + preValues.convertPreValues(store.values, new IDataTypeQuery() { + + Paths paths = cg.getPaths(); + StatementStore statements = store.statements; + ValueStore values = store.values; + int HasDatatype = store.identities.createPathToId(paths.HasDatatype); + int InstanceOf = store.identities.createPathToId(paths.InstanceOf); + + @Override + public Binding getDataType(int id) { + TIntArrayList objects = statements.getObjects(id, HasDatatype); + if(objects.isEmpty()) { + objects = statements.getObjects(id, InstanceOf); + for(int i=0;i typeBindingCache = new TIntObjectHashMap(); + private Binding getDatatypeForType(int type) { + if(typeBindingCache.containsKey(type)) + return typeBindingCache.get(type); + else { + Datatype dt = cg.getAssertedDatatype(store.idToRes(type)); + Binding binding = dt == null ? null : Bindings.getBinding(dt); + typeBindingCache.put(type, binding); + return binding; + } + } + }, problems); + } + +}