tip.util
Class IdentityEqualitor<T>

java.lang.Object
  extended by tip.util.IdentityEqualitor<T>
Type Parameters:
T - the type for which the equalitor applies
All Implemented Interfaces:
Equalitor<T>

public class IdentityEqualitor<T>
extends Object
implements Equalitor<T>

IdentityEqualitor implements the Equalitor interface by calling the Object.equals(Object) and Object.hashCode() methods.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
IdentityEqualitor()
           
 
Method Summary
 boolean equals(Object o)
          
 boolean equals(T a, T b)
          Returns true if the elements a and b are equal according to this {link Equalitor}.
 int hashCode()
          
 int hashCode(T a)
          Returns the hashcode for the element a according to this Equalitor.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityEqualitor

public IdentityEqualitor()
Method Detail

equals

public boolean equals(T a,
                      T b)
Returns true if the elements a and b are equal according to this {link Equalitor}. If the elements are equal, then we must have hashCode(a) == hashCode(b). The method must handle the case where a or b is null. The equality relation must atleast be reflexive in the object reference, i.e. for all elements e we must have equals(e,e)==true.

Specified by:
equals in interface Equalitor<T>
Parameters:
a - the first element
b - the second element
Returns:
true if a and b are equal

hashCode

public int hashCode(T a)
Returns the hashcode for the element a according to this Equalitor. If Equalitor.equals(Object,Object) returns true, for two elements a and b, then for hashCode we must have hashCode(a) == hashCode(b). The method must handle the case where a is null.

Specified by:
hashCode in interface Equalitor<T>
Parameters:
a - the element
Returns:
the hashcode of a.

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object