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%2Ftemplates%2FGraphTemplate.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Ftemplates%2FGraphTemplate.java;h=0b3b921795029aa2e174969407c1d69d91bc9c46;hp=abf1a768860d31cdba64004d3feb128f8216f144;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 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..0b3b92179 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 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); + } + } +}