tip.cfg
Class MapLattice<A,L>

java.lang.Object
  extended by tip.cfg.MapLattice<A,L>
Type Parameters:
A - the type of the elements in the domain set
L - the type of the elements in the range lattice
All Implemented Interfaces:
Lattice<EqualityMap<A,L>>, Equalitor<EqualityMap<A,L>>

public class MapLattice<A,L>
extends Object
implements Lattice<EqualityMap<A,L>>

MapLattice defines a map lattice, AL, from a fixed set, A, containing the elements of the domain, and a lattice, L, for the range elements.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
MapLattice(Collection<A> domainSet, Lattice<L> rangeLattice)
          Creates a new map lattice using rangeLattice as the lattice for range elements and domainSet as the domain set.
MapLattice(EqualitySet<A> domainSet, Lattice<L> rangeLattice)
          Creates a new map lattice using rangeLattice as the lattice for range elements and domainSet as the domain set.
 
Method Summary
 boolean equals(EqualityMap<A,L> a, EqualityMap<A,L> b)
          Returns true if the maps a and b represent the same element in this map lattice.
 Equalitor<A> getDomainEqualitor()
          Returns the Equalitor used for the domain elements.
 EqualityMap<A,L> getLeastUpperBound(EqualityMap<A,L> a, EqualityMap<A,L> b)
          Returns the least upper bound of the maps a and b according to this map lattice.
 Lattice<L> getRangeLattice()
          Returns the Lattice for the range elements.
 EqualityMap<A,L> getSmallestElement()
          Returns the smallest element of this map lattice.
 int hashCode(EqualityMap<A,L> a)
          Returns the hashcode for the map a according to this map lattice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapLattice

public MapLattice(Collection<A> domainSet,
                  Lattice<L> rangeLattice)
Creates a new map lattice using rangeLattice as the lattice for range elements and domainSet as the domain set. The equalitor for the domain elements will be the IdentityEqualitor.

Parameters:
domainSet - the set of elements in the domain
rangeLattice - the lattice for the range element

MapLattice

public MapLattice(EqualitySet<A> domainSet,
                  Lattice<L> rangeLattice)
Creates a new map lattice using rangeLattice as the lattice for range elements and domainSet as the domain set. The equalitor for the domain elements will be the equalitor from domainSet.

Parameters:
domainSet - the set of elements in the domain
rangeLattice - the lattice for the range element
Method Detail

getDomainEqualitor

public Equalitor<A> getDomainEqualitor()
Returns the Equalitor used for the domain elements.

Returns:
the Equalitor used for the domain elements

getRangeLattice

public Lattice<L> getRangeLattice()
Returns the Lattice for the range elements.

Returns:
the Lattice for for the range elements.

getSmallestElement

public EqualityMap<A,L> getSmallestElement()
Returns the smallest element of this map lattice.

Specified by:
getSmallestElement in interface Lattice<EqualityMap<A,L>>
Returns:
the smallest element of this map lattice

getLeastUpperBound

public EqualityMap<A,L> getLeastUpperBound(EqualityMap<A,L> a,
                                           EqualityMap<A,L> b)
Returns the least upper bound of the maps a and b according to this map lattice.

Specified by:
getLeastUpperBound in interface Lattice<EqualityMap<A,L>>
Parameters:
a - the first map
b - the second map
Returns:
the least upper bound of the maps a and b according to this map lattice

equals

public boolean equals(EqualityMap<A,L> a,
                      EqualityMap<A,L> b)
Returns true if the maps a and b represent the same element in this map lattice.

Specified by:
equals in interface Equalitor<EqualityMap<A,L>>
Parameters:
a - the first map
b - the second map
Returns:
true if the maps a and b represent the same element in this map lattice

hashCode

public int hashCode(EqualityMap<A,L> a)
Returns the hashcode for the map a according to this map lattice.

Specified by:
hashCode in interface Equalitor<EqualityMap<A,L>>
Parameters:
a - the map in question
Returns:
the hashcode for the map a according to this map lattice