change
[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 static TempDescriptor tempFactory() {
40     return new TempDescriptor("temp_"+currentid);
41   }
42
43   public static TempDescriptor tempFactory(String name) {
44     return new TempDescriptor(name+currentid);
45   }
46
47   public static TempDescriptor tempFactory(String name, TypeDescriptor td) {
48     return new TempDescriptor(name+currentid,td);
49   }
50
51   public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) {
52     return new TempDescriptor(name+currentid,type,tag);
53   }
54
55   public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) {
56     return new TempDescriptor(name,td);
57   }
58
59   public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) {
60     return new TempDescriptor(name, tagtype, tag);
61   }
62
63   public String toString() {
64     return safename;
65   }
66
67   public void setType(TypeDescriptor td) {
68     type=td;
69   }
70
71   public TypeDescriptor getType() {
72     return type;
73   }
74
75   public TagDescriptor getTag() {
76     return tag;
77   }
78
79   public void setTag(TagDescriptor tag) {
80     this.tag=tag;
81   }
82 }