예제 #1
0
  /** Returns a hashCode consistent with object equality. */
  public int hashCode() {
    if (!isHashCodeChosen) {
      // Set the hash code for this object

      if (name != null & type != null) fixedHashCode = name.hashCode() + 19 * type.hashCode();
      else if (name != null) fixedHashCode = name.hashCode();
      else if (type != null) fixedHashCode = type.hashCode();
      else fixedHashCode = 1;

      isHashCodeChosen = true;
    }

    return fixedHashCode;
  }
예제 #2
0
 /** Returns a hash code for this object, consistent with structural equality. */
 public int equivHashCode() {
   return name.hashCode() * 101 + type.hashCode() * 17;
 }