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%2Fstore%2FVariableStore.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fstore%2FVariableStore.java;h=567435a946eea6864ff416854586723de8b1c7fc;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/store/VariableStore.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/store/VariableStore.java new file mode 100644 index 000000000..567435a94 --- /dev/null +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/store/VariableStore.java @@ -0,0 +1,38 @@ +package org.simantics.graph.compiler.internal.store; + +import gnu.trove.map.hash.TIntIntHashMap; + +import java.util.ArrayList; +import java.util.List; + +import org.simantics.graph.compiler.SourceInfo; +import org.simantics.graph.compiler.SourceInfo.DefinitionPosition; +import org.simantics.graph.compiler.SourceInfo.SourceFile; +import org.simantics.graph.compiler.SourceInfo.Variable; +import org.simantics.graph.store.IStore; + +public class VariableStore implements IStore { + + public List sourceFiles = new ArrayList(); + + @Override + public void map(TIntIntHashMap map) { + for(SourceFile file : sourceFiles) { + for(Variable variable : file.variables) + if(map.contains(variable.resource)) + variable.resource = map.get(variable.resource); + for(DefinitionPosition pos : file.definitionPositions) + if(map.contains(pos.resource)) + pos.resource = map.get(pos.resource); + } + } + + public SourceInfo getSourceInfo() { + return new SourceInfo(sourceFiles); + } + + public void addSourceFile(SourceFile sourceFile) { + sourceFiles.add(sourceFile); + } + +}