tip.cfg
Class UnionSetLattice<L>

java.lang.Object
  extended by tip.cfg.UnionSetLattice<L>
Type Parameters:
L - the type of the elements in the set
All Implemented Interfaces:
Lattice<EqualitySet<L>>, Equalitor<EqualitySet<L>>

public class UnionSetLattice<L>
extends Object
implements Lattice<EqualitySet<L>>

UnionSetLattice defines a set lattice with elements of type L and with union as least-upper-bound operator. This is used for may-analyses over sets.

UnionSetLattice defines a lattice whos elements are EqualitySet sets with L as the type of the elements.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
UnionSetLattice()
          Creates a new UnionSetLattice using the IdentityEqualitor as equalitor used for element equality.
UnionSetLattice(Equalitor<L> equalitor)
          Creates a new UnionSetLattice using the equalitor as Equalitor used for element equality.
 
Method Summary
 boolean equals(EqualitySet<L> a, EqualitySet<L> b)
          Returns true if the sets a and b represent the same element in this set lattice.
 EqualitySet<L> getLeastUpperBound(EqualitySet<L> a, EqualitySet<L> b)
          Returns the least upper bound of the sets a and b according to this set lattice.
 EqualitySet<L> getSmallestElement()
          Returns the smallest element of this set lattice.
 int hashCode(EqualitySet<L> a)
          Returns the hashcode of the set a according to this set lattice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnionSetLattice

public UnionSetLattice()
Creates a new UnionSetLattice using the IdentityEqualitor as equalitor used for element equality.


UnionSetLattice

public UnionSetLattice(Equalitor<L> equalitor)
Creates a new UnionSetLattice using the equalitor as Equalitor used for element equality.

Parameters:
equalitor - the Equalitor used for element equality
Throws:
IllegalArgumentException - if no equalitor is provided
Method Detail

equals

public boolean equals(EqualitySet<L> a,
                      EqualitySet<L> b)
Returns true if the sets a and b represent the same element in this set lattice.

Specified by:
equals in interface Equalitor<EqualitySet<L>>
Parameters:
a - the first set
b - the second set
Returns:
true if the sets a and b represent the same element in this set lattice

hashCode

public int hashCode(EqualitySet<L> a)
Returns the hashcode of the set a according to this set lattice.

Specified by:
hashCode in interface Equalitor<EqualitySet<L>>
Parameters:
a - the set in question
Returns:
the hashcode of the set a according to this set lattice

getSmallestElement

public EqualitySet<L> getSmallestElement()
Returns the smallest element of this set lattice.

Specified by:
getSmallestElement in interface Lattice<EqualitySet<L>>
Returns:
the smallest element of this set lattice

getLeastUpperBound

public EqualitySet<L> getLeastUpperBound(EqualitySet<L> a,
                                         EqualitySet<L> b)
Returns the least upper bound of the sets a and b according to this set lattice. The least upper bound is the union of the sets.

Specified by:
getLeastUpperBound in interface Lattice<EqualitySet<L>>
Parameters:
a - the first set
b - the second set
Returns:
the least upper bound of the sets a and b according to this set lattice