tip.util
Interface Equalitor<T>

Type Parameters:
T - the type of elements
All Known Subinterfaces:
Lattice<T>
All Known Implementing Classes:
ConstantPropagationAnalysis.ConstLattice, DivisionAnalysis.Div, ExpressionEqualitor, IdentityEqualitor, IntersectionSetLattice, IntervalAnalysis.Interval, MapLattice, NullPointerAnalysis.NullLattice, SignAnalysis.SignLattice, UnionSetLattice

public interface Equalitor<T>

Equalitor defines an interface for an abstraction of the equals and hashCode methods.

Author:
Johnni Winther, jw@brics.dk

Method Summary
 boolean equals(T a, T b)
          Returns true if the elements a and b are equal according to this {link Equalitor}.
 int hashCode(T a)
          Returns the hashcode for the element a according to this Equalitor.
 

Method Detail

equals

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.

Parameters:
a - the first element
b - the second element
Returns:
true if a and b are equal

hashCode

int hashCode(T a)
Returns the hashcode for the element a according to this Equalitor. If 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.

Parameters:
a - the element
Returns:
the hashcode of a.