1 package gov.nasa.jpf.jvm; 20 21 25 public abstract class Ref { 26 public static final ObjRef NULL = new ObjRef(-1); 27 int reference; 28 boolean isClass; 29 30 protected Ref (int r, boolean c) { 31 reference = r; 32 isClass = c; 33 } 34 35 public boolean isClass () { 36 return isClass; 37 } 38 39 public boolean isNull () { 40 return reference == -1; 41 } 42 43 public int getReference () { 44 return reference; 45 } 46 47 public abstract Object clone (); 48 49 public boolean equals (Object o) { 50 return (reference == ((Ref) o).reference) && 51 (isClass == ((Ref) o).isClass); 52 } 53 54 public int hashCode () { 55 return reference; 56 } 57 58 public String toString () { 59 return (isClass ? "@" : "#") + reference; 60 } 61 } | Popular Tags |