X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Ftemplates%2FGraphTemplate.java;h=3576dab377cf0a2a68b08bf557ff2f94df5bbc7e;hb=HEAD;hp=abf1a768860d31cdba64004d3feb128f8216f144;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/GraphTemplate.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/GraphTemplate.java index abf1a7688..3576dab37 100644 --- a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/GraphTemplate.java +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/GraphTemplate.java @@ -1,100 +1,100 @@ -package org.simantics.graph.compiler.internal.templates; - -import gnu.trove.map.hash.TIntIntHashMap; -import gnu.trove.map.hash.TObjectIntHashMap; - -import java.util.Arrays; -import java.util.Collection; - -import org.simantics.graph.compiler.ExternalFileLoader; -import org.simantics.graph.compiler.internal.store.LocationStore; -import org.simantics.graph.query.IGraph; -import org.simantics.graph.representation.External; -import org.simantics.graph.representation.Identity; -import org.simantics.graph.representation.Root; -import org.simantics.graph.representation.TransferableGraph1; -import org.simantics.graph.representation.Value; -import org.simantics.graph.store.GraphStore; -import org.simantics.graph.store.IdentityStore; -import org.simantics.graph.store.StatementStore; -import org.simantics.graph.store.ValueStore; -import org.simantics.ltk.Location; -import org.simantics.ltk.Problem; - -public class GraphTemplate implements ITemplate { - int[] prototypeResources; - int[] parameterMapping; - int[] statements; - Value[] values; - - public GraphTemplate(GraphStore store, String[] parameters, TransferableGraph1 tg) { - prototypeResources = new int[tg.resourceCount]; - Arrays.fill(prototypeResources, -1); - - this.values = tg.values; - this.statements = tg.statements; - this.parameterMapping = new int[parameters.length]; - TObjectIntHashMap pmap = new TObjectIntHashMap(); - for(int i=0;i problems) { - if(parameters.length != parameterMapping.length) { - Location location = store.getStore(LocationStore.class) - .getLocation(parameters[0]); - problems.add(new Problem(location, "A template applied with wrong number of parameters.")); - return; - } - int[] resources = Arrays.copyOf(prototypeResources, prototypeResources.length); - for(int i=0;i= 0 && map.contains(temp)) - prototypeResources[i] = map.get(temp); - } - } -} +package org.simantics.graph.compiler.internal.templates; + +import java.util.Arrays; +import java.util.Collection; + +import org.simantics.graph.compiler.ExternalFileLoader; +import org.simantics.graph.compiler.internal.ltk.Location; +import org.simantics.graph.compiler.internal.ltk.Problem; +import org.simantics.graph.compiler.internal.store.LocationStore; +import org.simantics.graph.query.IGraph; +import org.simantics.graph.representation.External; +import org.simantics.graph.representation.Identity; +import org.simantics.graph.representation.Root; +import org.simantics.graph.representation.TransferableGraph1; +import org.simantics.graph.representation.Value; +import org.simantics.graph.store.GraphStore; +import org.simantics.graph.store.IdentityStore; +import org.simantics.graph.store.StatementStore; +import org.simantics.graph.store.ValueStore; + +import gnu.trove.map.hash.TIntIntHashMap; +import gnu.trove.map.hash.TObjectIntHashMap; + +public class GraphTemplate implements ITemplate { + int[] prototypeResources; + int[] parameterMapping; + int[] statements; + Value[] values; + + public GraphTemplate(GraphStore store, String[] parameters, TransferableGraph1 tg) { + prototypeResources = new int[tg.resourceCount]; + Arrays.fill(prototypeResources, -1); + + this.values = tg.values; + this.statements = tg.statements; + this.parameterMapping = new int[parameters.length]; + TObjectIntHashMap pmap = new TObjectIntHashMap(); + for(int i=0;i problems) { + if(parameters.length != parameterMapping.length) { + Location location = store.getStore(LocationStore.class) + .getLocation(parameters[0]); + problems.add(new Problem(location, "A template applied with wrong number of parameters.")); + return; + } + int[] resources = Arrays.copyOf(prototypeResources, prototypeResources.length); + for(int i=0;i= 0 && map.contains(temp)) + prototypeResources[i] = map.get(temp); + } + } +}