1 package gov.nasa.jpf.jvm; 20 21 import gov.nasa.jpf.util.HashData; 22 23 24 27 class ThreadData { 28 31 int status; 32 33 34 int priority = java.lang.Thread.NORM_PRIORITY; 35 36 40 String name = ""; 41 42 43 boolean isDaemon; 44 45 48 ClassInfo ci; 49 50 53 int objref; 54 55 58 int target = -1; 59 60 63 int lockCount; 64 65 66 public Object clone () { 67 ThreadData t = new ThreadData(); 68 69 t.status = status; 70 t.ci = ci; 71 t.objref = objref; 72 t.target = target; 73 t.lockCount = lockCount; 74 75 t.priority = priority; 76 t.name = name; 77 t.isDaemon = isDaemon; 78 79 return t; 80 } 81 82 public boolean equals (Object o) { 83 if ((o == null) || !(o instanceof ThreadData)) { 84 return false; 85 } 86 87 ThreadData t = (ThreadData) o; 88 89 return ((status == t.status) && (ci == t.ci) && (objref == t.objref) && 90 (target == t.target) && (priority == t.priority) && 91 (isDaemon == t.isDaemon) && (lockCount == t.lockCount) && 92 (name.equals(t.name))); 93 } 94 95 public void hash (HashData hd) { 96 hd.add(status); 97 hd.add(objref); 98 hd.add(target); 99 hd.add(lockCount); 100 hd.add(priority); 101 hd.add(isDaemon); 102 hd.add(name); 103 104 Boolean bo; 105 } 106 107 public int hashCode () { 108 HashData hd = new HashData(); 109 110 hash(hd); 111 112 return hd.getValue(); 113 } 114 115 public String toString () { 116 StringBuffer sb = new StringBuffer (); 117 118 sb.append("ThreadData("); 119 sb.append("status="); 120 sb.append(status); 121 sb.append(",ci="); 122 123 if (ci == null) { 124 sb.append("null"); 125 } else { 126 sb.append(ci.getName()); 127 } 128 129 sb.append(",objref="); 130 sb.append(objref); 131 sb.append(",target="); 132 sb.append(target); 133 sb.append(",priority="); 134 sb.append(priority); 135 sb.append(",name="); 136 sb.append(name); 137 sb.append(",lockCount="); 138 sb.append(lockCount); 139 sb.append(')'); 140 141 return sb.toString(); 142 } 143 } 144 | Popular Tags |