1bd8067e1b3562c9d2ccc20c2e931c4e6c0585ca
[IRC.git] / Robust / src / IR / State.java
1 package IR;
2 import IR.Tree.*;
3 import IR.Flat.*;
4 import IR.*;
5 import java.util.*;
6
7 public class State {
8     public State(ParseNode parsetree) {
9         globals=new SymbolTable();
10         this.parsetree=parsetree;
11         this.classset=new HashSet();
12         this.treemethodmap=new Hashtable();
13         this.flatmethodmap=new Hashtable();
14     }
15
16     public SymbolTable globals;
17     public ParseNode parsetree;
18     public HashSet classset;
19     public Hashtable treemethodmap;
20     public Hashtable flatmethodmap;
21
22     public static TypeDescriptor getTypeDescriptor(int t) {
23         TypeDescriptor td=new TypeDescriptor(t);
24         return td;
25     }
26
27     public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
28         TypeDescriptor td=new TypeDescriptor(n);
29         return td;
30     }
31
32     public void addClass(ClassDescriptor tdn) {
33         classset.add(tdn);
34     }
35
36     public BlockNode getMethodBody(MethodDescriptor md) {
37         return (BlockNode)treemethodmap.get(md);
38         
39     }
40
41     public FlatMethod getMethodFlat(MethodDescriptor md) {
42         return (FlatMethod)flatmethodmap.get(md);
43     }
44
45     public void addTreeCode(MethodDescriptor md, BlockNode bn) {
46         treemethodmap.put(md,bn);
47     }
48
49     public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
50         flatmethodmap.put(md,bn);
51     }
52 }