12657520f57320e1a89fc8871082afd533fb4ff0
[IRC.git] / Robust / src / IR / Flat / TempDescriptor.java
1 package IR.Flat;
2 import IR.*;
3
4 public class TempDescriptor extends Descriptor {
5   static int currentid=0;
6   int id;
7   //    String safename;
8   TypeDescriptor type;
9   TagDescriptor tag;
10
11   public TempDescriptor(String name) {
12     super(name);
13     id=currentid++;
14   }
15
16   public TempDescriptor(String name, TypeDescriptor td) {
17     this(name);
18     type=td;
19   }
20
21   public TempDescriptor(String name, ClassDescriptor cd) {
22     this(name);
23     type=new TypeDescriptor(cd);
24   }
25
26   public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) {
27     this(name);
28     this.type=type;
29     tag=td;
30   }
31
32   public TempDescriptor createNew() {
33     if (tag==null)
34       return new TempDescriptor(name+"_"+currentid, type);
35     else
36       return new TempDescriptor(name+"_"+currentid, type, tag);
37   }
38
39   public TempDescriptor createNew(String x) {
40     if (tag==null)
41       return new TempDescriptor(name+"_"+currentid+"_"+x, type);
42     else
43       return new TempDescriptor(name+"_"+currentid+"_"+x, type, tag);
44   }
45
46   public static TempDescriptor tempFactory() {
47     return new TempDescriptor("temp_"+currentid);
48   }
49
50   public static TempDescriptor tempFactory(String name) {
51     return new TempDescriptor(name+currentid);
52   }
53
54   public static TempDescriptor tempFactory(String name, TypeDescriptor td) {
55     return new TempDescriptor(name+currentid,td);
56   }
57
58   public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) {
59     return new TempDescriptor(name+currentid,type,tag);
60   }
61
62   public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) {
63     return new TempDescriptor(name,td);
64   }
65
66   public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) {
67     return new TempDescriptor(name, tagtype, tag);
68   }
69
70   public String toString() {
71     return safename;
72   }
73
74   public void setType(TypeDescriptor td) {
75     type=td;
76   }
77
78   public TypeDescriptor getType() {
79     return type;
80   }
81
82   public TagDescriptor getTag() {
83     return tag;
84   }
85
86   public void setTag(TagDescriptor tag) {
87     this.tag=tag;
88   }
89 }