de.rwth.domains.templates
Class FlatCompleteLattice

java.lang.Object
  |
  +--de.rwth.domains.templates.FlatCompleteLattice
All Implemented Interfaces:
CompleteLattice, CompletePOSet, Lattice, LowerSemiLattice, POSet, PreLattice, PreLowerSemiLattice, PreUpperSemiLattice, Set, UpperSemiLattice
Direct Known Subclasses:
CFPComponentLattice, SSLattice

public class FlatCompleteLattice
extends java.lang.Object
implements CompleteLattice

Creates a flat complete lattice from a set and explicit top and bottom elements. The Hasse diagram of the resulting structure looks like this:

       TOP
  / ... | ... \
  (set elements)
  \ ... | ... /
      BOTTOM
 

Version:
$Id: FlatCompleteLattice.java,v 1.2 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Inner classes inherited from class de.rwth.domains.Set
Set.Default
 
Field Summary
protected  java.lang.Object bottom
          The top element.
protected  Set set
          The set inside.
protected  java.lang.Object top
          The bottom element.
 
Constructor Summary
FlatCompleteLattice(Set set)
          Creates a new FlatCompleteLattice instance from a set.
FlatCompleteLattice(Set set, java.lang.Object bottom, java.lang.Object top)
          Creates a new FlatCompleteLattice instance from a set and explicit top and bottom elements.
FlatCompleteLattice(Set set, java.lang.String botlabel, java.lang.String toplabel)
          Creates a new FlatCompleteLattice instance from a set and names for newly created unique top and bottom elements.
 
Method Summary
 java.lang.Object bottom()
          Gets the least element of this CompleteLattice.
 boolean equals(java.lang.Object e1, java.lang.Object e2)
          Checks if two elements of this set are equal.
 boolean isElement(java.lang.Object e)
          Elements are those which are either top, bottom or one of the elements of the set.
 java.util.Iterator iterator()
          Returns an Iterator of the elements of this set.
 java.util.Iterator iteratorSkel()
          Returns an Iterator of the elements of the skeleton subset this set.
 java.lang.Object join(java.lang.Object o1, java.lang.Object o2)
          If the arguments are equal, then the join is, too; Otherwise, its top.
 boolean le(java.lang.Object e1, java.lang.Object e2)
          Bottom is less-or-equal to everything, everything is less-or-equal to top, and set elements are never less-than each other.
 boolean lt(java.lang.Object e1, java.lang.Object e2)
          Checks if one element is less than an other element.
static void main(java.lang.String[] args)
          Mini test environment.
 java.lang.Object meet(java.lang.Object o1, java.lang.Object o2)
          If the arguments are equal, then the meet is, too; Otherwise, its bottom.
 long size()
          The size of the set plus 2, or -1 if the set is infinite.
 long sizeSkel()
          The size of the set skeleton plus 2, or -1 if the set skeleton is infinite.
 java.lang.Object top()
          Gets the greatest element of this CompleteLattice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bottom

protected java.lang.Object bottom
The top element.

top

protected java.lang.Object top
The bottom element.

set

protected Set set
The set inside.
Constructor Detail

FlatCompleteLattice

public FlatCompleteLattice(Set set,
                           java.lang.Object bottom,
                           java.lang.Object top)
Creates a new FlatCompleteLattice instance from a set and explicit top and bottom elements.
Parameters:
set - a Set value
bottom - an Object value
top - an Object value

FlatCompleteLattice

public FlatCompleteLattice(Set set,
                           java.lang.String botlabel,
                           java.lang.String toplabel)
Creates a new FlatCompleteLattice instance from a set and names for newly created unique top and bottom elements.
Parameters:
set - a Set value
botlabel - a String value
toplabel - a String value

FlatCompleteLattice

public FlatCompleteLattice(Set set)
Creates a new FlatCompleteLattice instance from a set. Top and bottom elements are newly created and named "top" and "bot".
Parameters:
set - a Set value
Method Detail

equals

public boolean equals(java.lang.Object e1,
                      java.lang.Object e2)
Description copied from interface: Set
Checks if two elements of this set are equal.
Implementations should guarantee that equals is reflexive, transitive and symmetric. Furthermore, equals(e1,e2) should coincide with e1.equals(e2).
Specified by:
equals in interface Set
Following copied from interface: de.rwth.domains.Set
Parameters:
e1 - a value of type Object
e2 - a value of type Object
Returns:
true if e1 and e2 belong to this set and are equal, false otherwise
See Also:
Domain.checkProperties(Set set)

isElement

public boolean isElement(java.lang.Object e)
Elements are those which are either top, bottom or one of the elements of the set.
Specified by:
isElement in interface Set
Parameters:
e - an Object value
Returns:
a boolean value

iterator

public java.util.Iterator iterator()
Description copied from interface: Set
Returns an Iterator of the elements of this set.
Implementations should guarantee that:
Specified by:
iterator in interface Set
Following copied from interface: de.rwth.domains.Set
Returns:
an Iterator of all elements of this set.
See Also:
Set.isElement(Object e), Domain.checkProperties(Set set)

size

public long size()
The size of the set plus 2, or -1 if the set is infinite.
Specified by:
size in interface Set
Returns:
a long value

sizeSkel

public long sizeSkel()
The size of the set skeleton plus 2, or -1 if the set skeleton is infinite.
Specified by:
sizeSkel in interface Set
Returns:
a long value

iteratorSkel

public java.util.Iterator iteratorSkel()
Description copied from interface: Set
Returns an Iterator of the elements of the skeleton subset this set. It maybe null if there is no skeleton subset.
Implementations should guarantee that:
Specified by:
iteratorSkel in interface Set
Following copied from interface: de.rwth.domains.Set
Returns:
an Iterator of all elements of this set.
See Also:
Set.isElement(Object e), Domain.checkProperties(Set set)

le

public boolean le(java.lang.Object e1,
                  java.lang.Object e2)
Bottom is less-or-equal to everything, everything is less-or-equal to top, and set elements are never less-than each other.
Specified by:
le in interface POSet
Parameters:
e1 - an Object value
e2 - an Object value
Returns:
a boolean value

lt

public boolean lt(java.lang.Object e1,
                  java.lang.Object e2)
Description copied from interface: POSet
Checks if one element is less than an other element.

Implementations should guarantee that lt is reflexive, transitive and anti-symmetric. Furthermore, lt(e1,e2) should be the same as le(e1,e2)&&!equals(e1,e2).

Specified by:
lt in interface POSet
Following copied from interface: de.rwth.domains.POSet
Parameters:
e1 - a value of type Object
e2 - a value of type Object
Returns:
true iff both e1 and e2 are elements in this set and e1 is less or equals than /e2.
See Also:
Domain.checkProperties(POSet poset)

meet

public java.lang.Object meet(java.lang.Object o1,
                             java.lang.Object o2)
If the arguments are equal, then the meet is, too; Otherwise, its bottom.
Specified by:
meet in interface Lattice
Parameters:
o1 - an Object value
o2 - an Object value
Returns:
an Object value

join

public java.lang.Object join(java.lang.Object o1,
                             java.lang.Object o2)
If the arguments are equal, then the join is, too; Otherwise, its top.
Specified by:
join in interface Lattice
Parameters:
o1 - an Object value
o2 - an Object value
Returns:
an Object value

top

public java.lang.Object top()
Description copied from interface: CompleteLattice
Gets the greatest element of this CompleteLattice.

Implementations should guarantee that bottom is indeed least element of this set, this is to say that isElement recognises the value returned by bottom and lt(bottom(),e)==true for all elements e.

Specified by:
top in interface CompleteLattice
Following copied from interface: de.rwth.domains.CompleteLattice
Returns:
the greatest element in this set
See Also:
Domain.checkProperties(CompleteLattice cl)

bottom

public java.lang.Object bottom()
Description copied from interface: CompleteLattice
Gets the least element of this CompleteLattice.

Implementations should guarantee that bottom is indeed least element of this set, this is to say that isElement recognises the value returned by bottom and lt(bottom(),e)==true for all elements e.

Specified by:
bottom in interface CompleteLattice
Following copied from interface: de.rwth.domains.CompleteLattice
Returns:
the least element in this set
See Also:
Domain.checkProperties(CompleteLattice cl)

main

public static void main(java.lang.String[] args)
Mini test environment.
Parameters:
args - a String[] value