1 package org.simantics.graph.compiler.internal.translation;
\r
3 import gnu.trove.list.array.TIntArrayList;
\r
5 import org.antlr.runtime.tree.Tree;
\r
6 import org.simantics.graph.store.GraphStore;
\r
8 public class ChildGraphTranslator extends GraphTranslator {
\r
10 TIntArrayList correspondences = new TIntArrayList();
\r
11 GraphTranslator parent;
\r
13 public ChildGraphTranslator(GraphTranslator parent, GraphStore store) {
\r
14 super(parent.paths, parent.problems, store);
\r
15 this.parent = parent;
\r
19 public int getVariable(Tree place, String text) {
\r
20 if(variables.containsKey(text))
\r
21 return variables.get(text);
\r
23 correspondences.add(parent.getVariable(place, text));
\r
24 int id = identities.newResource();
\r
25 correspondences.add(id);
\r
26 variables.put(text, id);
\r
32 public int[] getCorrespondences() {
\r
33 return correspondences.toArray();
\r