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%2FListTemplate.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Ftemplates%2FListTemplate.java;h=e30b1a5f0fea9e9c8b2e38ad4fab79db5294fca3;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/ListTemplate.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/ListTemplate.java new file mode 100644 index 000000000..e30b1a5f0 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/templates/ListTemplate.java @@ -0,0 +1,39 @@ +package org.simantics.graph.compiler.internal.templates; + +import java.util.Collection; + +import org.simantics.graph.compiler.ExternalFileLoader; +import org.simantics.graph.query.IGraph; +import org.simantics.graph.query.Paths; +import org.simantics.graph.store.GraphStore; +import org.simantics.ltk.Problem; + +public enum ListTemplate implements ITemplate { + + INSTANCE; + + @Override + public void apply(IGraph graph, GraphStore store, + int[] parameters, ExternalFileLoader fileLoader, Collection problems) { + createList(graph.getPaths(), store, parameters); + } + + public static void createList(Paths paths, GraphStore store, int[] parameters) { + int InstanceOf = store.identities.createPathToId(paths.InstanceOf); + int Entry = store.identities.createPathToId(paths.List_Entry); + int Next = store.identities.createPathToId(paths.List_Next); + int Element = store.identities.createPathToId(paths.List_Element); + + int oldEntry = parameters[0]; + for(int i=1;i