149 // blindly and screen out all the duplicates at once. 150 } 151 152 void addReferenceFromRoot(Root r) { 153 getClazz().addReferenceFromRoot(r, this); 154 } 155 156 /** 157 * If the rootset includes this object, return a Root describing one 158 * of the reasons why. 159 */ 160 public Root getRoot() { 161 return getClazz().getRoot(this); 162 } 163 164 /** 165 * Tell who refers to us. 166 * 167 * @return an Enumeration of JavaHeapObject instances 168 */ 169 public Enumeration getReferers() { 170 if (referersLen != -1) { 171 throw new RuntimeException("not resolved: " + getIdString()); 172 } 173 return new Enumeration() { 174 175 private int num = 0; 176 177 public boolean hasMoreElements() { 178 return referers != null && num < referers.length; 179 } 180 181 public Object nextElement() { 182 return referers[num++]; 183 } 184 }; 185 } 186 187 /** 188 * Given other, which the caller promises is in referers, determines if 189 * the reference is only a weak reference. 190 */ 191 public boolean refersOnlyWeaklyTo(Snapshot ss, JavaThing other) { 192 return false; 193 } 194 195 /** 196 * Describe the reference that this thing has to target. This will only 197 * be called if target is in the array returned by getChildrenForRootset. 198 */ 199 public String describeReferenceTo(JavaThing target, Snapshot ss) { 200 return "??"; 201 } | 149 // blindly and screen out all the duplicates at once. 150 } 151 152 void addReferenceFromRoot(Root r) { 153 getClazz().addReferenceFromRoot(r, this); 154 } 155 156 /** 157 * If the rootset includes this object, return a Root describing one 158 * of the reasons why. 159 */ 160 public Root getRoot() { 161 return getClazz().getRoot(this); 162 } 163 164 /** 165 * Tell who refers to us. 166 * 167 * @return an Enumeration of JavaHeapObject instances 168 */ 169 public Enumeration<JavaThing> getReferers() { 170 if (referersLen != -1) { 171 throw new RuntimeException("not resolved: " + getIdString()); 172 } 173 return new Enumeration<JavaThing>() { 174 175 private int num = 0; 176 177 public boolean hasMoreElements() { 178 return referers != null && num < referers.length; 179 } 180 181 public JavaThing nextElement() { 182 return referers[num++]; 183 } 184 }; 185 } 186 187 /** 188 * Given other, which the caller promises is in referers, determines if 189 * the reference is only a weak reference. 190 */ 191 public boolean refersOnlyWeaklyTo(Snapshot ss, JavaThing other) { 192 return false; 193 } 194 195 /** 196 * Describe the reference that this thing has to target. This will only 197 * be called if target is in the array returned by getChildrenForRootset. 198 */ 199 public String describeReferenceTo(JavaThing target, Snapshot ss) { 200 return "??"; 201 } |