1 package org.simantics.graph.compiler.internal.store;
3 import gnu.trove.map.hash.TIntIntHashMap;
5 import java.util.ArrayList;
8 import org.simantics.graph.compiler.SourceInfo;
9 import org.simantics.graph.compiler.SourceInfo.DefinitionPosition;
10 import org.simantics.graph.compiler.SourceInfo.SourceFile;
11 import org.simantics.graph.compiler.SourceInfo.Variable;
12 import org.simantics.graph.store.IStore;
14 public class VariableStore implements IStore {
16 public List<SourceFile> sourceFiles = new ArrayList<SourceFile>();
19 public void map(TIntIntHashMap map) {
20 for(SourceFile file : sourceFiles) {
21 for(Variable variable : file.variables)
22 if(map.contains(variable.resource))
23 variable.resource = map.get(variable.resource);
24 for(DefinitionPosition pos : file.definitionPositions)
25 if(map.contains(pos.resource))
26 pos.resource = map.get(pos.resource);
30 public SourceInfo getSourceInfo() {
31 return new SourceInfo(sourceFiles);
34 public void addSourceFile(SourceFile sourceFile) {
35 sourceFiles.add(sourceFile);