public State() {
this.classes=new SymbolTable();
+ this.tasks=new SymbolTable();
this.treemethodmap=new Hashtable();
this.flatmethodmap=new Hashtable();
this.parsetrees=new HashSet();
}
public SymbolTable classes;
+ public SymbolTable tasks;
public Set parsetrees;
public Hashtable treemethodmap;
public Hashtable flatmethodmap;
private HashSet arraytypes;
public Hashtable arraytonumber;
private int numclasses=0;
+ private int numtasks=0;
private int arraycount=0;
public void addArrayType(TypeDescriptor td) {
- arraytypes.add(td);
- arraytonumber.put(td,new Integer(arraycount++));
+ if (!arraytypes.contains(td)) {
+ arraytypes.add(td);
+ arraytonumber.put(td,new Integer(arraycount++));
+ }
}
public Iterator getArrayIterator() {
return (BlockNode)treemethodmap.get(md);
}
+ public BlockNode getMethodBody(TaskDescriptor td) {
+ return (BlockNode)treemethodmap.get(td);
+ }
+
public SymbolTable getClassSymbolTable() {
return classes;
}
+ public SymbolTable getTaskSymbolTable() {
+ return tasks;
+ }
+
public FlatMethod getMethodFlat(MethodDescriptor md) {
return (FlatMethod)flatmethodmap.get(md);
}
treemethodmap.put(md,bn);
}
+ public void addTreeCode(TaskDescriptor td, BlockNode bn) {
+ treemethodmap.put(td,bn);
+ }
+
public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
flatmethodmap.put(md,bn);
}
+
+ public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
+ flatmethodmap.put(td,bn);
+ }
+
+ public void addTask(TaskDescriptor td) {
+ if (tasks.contains(td.getSymbol()))
+ throw new Error("Task "+td.getSymbol()+" defined twice");
+ tasks.add(td);
+ numtasks++;
+ }
}