DEADSOFTWARE

Remove batch
[gpcp-linux.git] / J2CPS / ClassRef.java
1 /*************************************************************************/
2 /* Class Reference class for J2CPS */
3 /* Represents the class references in the constant pool of a class file */
4 /* (c) copyright QUT */
5 /*************************************************************************/
6 package J2CPS;
8 public class ClassRef {
10 ConstantPool cp; /* the constant pool containing this class ref */
11 String name; /* the name of this class */
12 int nameIndex; /* the index into the constant pool */
13 /* for the name of this class */
14 ClassDesc info; /* this class info for this class ref */
16 public ClassRef(ConstantPool thisCp, int nameIndex) {
17 this.cp = thisCp;
18 this.nameIndex = nameIndex;
19 }
21 public String GetName() {
22 if (name == null) { name = (String) cp.Get(nameIndex); }
23 return name;
24 }
26 public ClassDesc GetClassDesc() {
27 if (info == null) {
28 if (name == null) { name = (String) this.cp.Get(nameIndex); }
29 info = ClassDesc.GetClassDesc(name,null);
30 }
31 return info;
32 }
34 public boolean equals(ClassRef anotherClass) {
35 return this.GetName().equals(anotherClass.GetName());
36 }
38 public void Resolve() {
39 if (name == null) { this.name = (String) this.cp.Get(nameIndex); }
40 }
42 @Override
43 public String toString() {
44 this.Resolve();
45 return ("<ClassReference> " + nameIndex + " " + name);
46 }
47 }