1 11 12 package org.eclipse.ui.internal.navigator.extensions; 13 14 import java.lang.ref.SoftReference ; 15 16 20 public class EvalutationReference extends SoftReference { 21 22 private final int hashCode; 23 24 private final Class type; 25 26 30 public EvalutationReference(Object referent) { 31 super(referent); 32 hashCode = referent.hashCode(); 33 type = referent.getClass(); 34 } 35 36 41 public int hashCode() { 42 return hashCode; 43 } 44 45 50 public boolean equals(Object obj) { 51 if (obj == null) 52 return false; 53 else if (obj instanceof EvalutationReference) { 54 if (!type.equals(((EvalutationReference) obj).type)) 55 return false; 56 return hashCode == obj.hashCode(); 57 } 58 return false; 59 } 60 61 64 public String toString() { 65 Object referent = get(); 66 if(referent == null) 67 return "Evalutation[type="+ type +"]"; return "Evalutation[referent="+ referent +"]"; } 70 71 } 72 | Popular Tags |