DEADSOFTWARE

Remove batch
[gpcp-linux.git] / J2CPS / Reference.java
1 /**********************************************************************/
2 /* Reference class for J2CPS */
3 /* */
4 /* (c) copyright QUT */
5 /**********************************************************************/
6 package J2CPS;
8 public class Reference {
10 ConstantPool cp; /* The constant pool containing this ref */
11 int classIndex; /* CP index for this reference's class */
12 int nameAndTypeIndex; /* CP index for this ref's name and type */
13 ClassRef classRef;
14 NameAndType nAndt;
15 String name;
16 String type;
18 public Reference(ConstantPool thisCp, int classIndex, int ntIndex) {
19 this.cp = thisCp;
20 this.classIndex = classIndex;
21 this.nameAndTypeIndex = ntIndex;
22 }
24 public String GetClassName() {
25 if (this.classRef == null) {
26 this.classRef = (ClassRef) this.cp.Get(classIndex);
27 }
28 return classRef.GetName();
29 }
31 public void Resolve() {
32 this.classRef = (ClassRef) this.cp.Get(classIndex);
33 this.nAndt = (NameAndType) this.cp.Get(nameAndTypeIndex);
34 this.name = nAndt.GetName();
35 this.type = nAndt.GetType();
36 }
38 @Override
39 public String toString() {
40 this.Resolve();
41 return ("Class " + classIndex + " NameAndType " + nameAndTypeIndex);
42 }
44 }