예제 #1
0
 /**
  * Indicates if two OIDs have the same base type and contain the same values. Note that if values
  * are null this isn't an ideal distinction; it's best to check "arePropertiesNull" before relying
  * on this equals method (see DomainObject's equals method for an example).
  */
 public boolean equals(Object obj) {
   if (obj instanceof OID) {
     OID oid = (OID) obj;
     // we rely on the toString ecause the HashMap.equals does not
     // give us what we need
     return m_type.getBasetype().equals(oid.m_type.getBasetype()) && m_values.equals(oid.m_values);
   }
   return false;
 }
예제 #2
0
 /**
  * Simple hashcode method to calculate hashcode based on the information used in the equals
  * method. Needed because we overrode equals; two equivalent objects must hash to the same value.
  */
 public int hashCode() {
   // here we rely on the values collection's hashcode method
   // to base its hashcode on the hashcodes of the contained values.
   return (m_type.getBasetype().hashCode() + m_values.hashCode());
 }