de.rwth.domains.templates
Class BitVectorLattice

java.lang.Object
  |
  +--de.rwth.domains.templates.BitVectorLattice
All Implemented Interfaces:
CompleteLattice, CompletePOSet, Lattice, LowerSemiLattice, POSet, PreLattice, PreLowerSemiLattice, PreUpperSemiLattice, Set, UpperSemiLattice

public class BitVectorLattice
extends java.lang.Object
implements CompleteLattice

Implements complete lattices of bit vectors.

Version:
$Id: BitVectorLattice.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  int n
          The fixed length of the bit vectors.
 
Constructor Summary
BitVectorLattice(int n)
          Creates a new BitVectorLattice instance.
 
Method Summary
 java.lang.Object bottom()
          The bottom element is (0,...,0).
 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)
          Checks if an element is contained in this set.
 java.util.Iterator iterator()
          Returns an iterator over all bit vectors.
 java.util.Iterator iteratorSkel()
          The same as iterator().
 java.lang.Object join(java.lang.Object e1, java.lang.Object e2)
          The join of two bit vectors is a bit vector where all those bits are set, which are set in one of the bit vectors.
 boolean le(java.lang.Object e1, java.lang.Object e2)
          A bit vector is less or equal than another one iff all bits set in the first one are also set in the second one
 boolean lt(java.lang.Object e1, java.lang.Object e2)
          A bit vector is less than another one iff its less-than-or-equal but not equal than the second.
static void main(java.lang.String[] args)
          Mini test environment.
 java.lang.Object meet(java.lang.Object e1, java.lang.Object e2)
          The meet of two bit vectors is a bit vector where all those bits are set, which are set in both of the bit vectors.
 long size()
          Returns the number of elements, which is 2n.
 long sizeSkel()
          The same as size().
 java.lang.Object top()
          The top element is (1,...,1).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

n

protected int n
The fixed length of the bit vectors.
Constructor Detail

BitVectorLattice

public BitVectorLattice(int n)
Creates a new BitVectorLattice instance.
Parameters:
n - an int value
Method Detail

size

public long size()
Returns the number of elements, which is 2n.
Specified by:
size in interface Set
Returns:
a long value

iterator

public java.util.Iterator iterator()
Returns an iterator over all bit vectors. It goes like this: (0,...,0), (0,...,0,1), ..., (1,...,1).
Specified by:
iterator in interface Set
Returns:
an Iterator value

sizeSkel

public long sizeSkel()
The same as size().
Specified by:
sizeSkel in interface Set
Returns:
a long value

iteratorSkel

public java.util.Iterator iteratorSkel()
The same as iterator().
Specified by:
iteratorSkel in interface Set
Returns:
an Iterator value

isElement

public boolean isElement(java.lang.Object e)
Description copied from interface: Set
Checks if an element is contained in this set.
Implementations should guarantee that isElement() is true for all objects generated by Set.iterator() and false for all other objects.
Specified by:
isElement in interface Set
Following copied from interface: de.rwth.domains.Set
Parameters:
e - a value of type Object
Returns:
true if and only if this set contains this element.
See Also:
Set.iterator(), Domain.checkProperties(Set set)

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)

le

public boolean le(java.lang.Object e1,
                  java.lang.Object e2)
A bit vector is less or equal than another one iff all bits set in the first one are also set in the second one
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)
A bit vector is less than another one iff its less-than-or-equal but not equal than the second.
Specified by:
lt in interface POSet
Parameters:
e1 - an Object value
e2 - an Object value
Returns:
a boolean value

join

public java.lang.Object join(java.lang.Object e1,
                             java.lang.Object e2)
The join of two bit vectors is a bit vector where all those bits are set, which are set in one of the bit vectors.
Specified by:
join in interface Lattice
Parameters:
e1 - an Object value
e2 - an Object value
Returns:
an Object value

meet

public java.lang.Object meet(java.lang.Object e1,
                             java.lang.Object e2)
The meet of two bit vectors is a bit vector where all those bits are set, which are set in both of the bit vectors.
Specified by:
meet in interface Lattice
Parameters:
e1 - an Object value
e2 - an Object value
Returns:
an Object value

top

public java.lang.Object top()
The top element is (1,...,1).
Specified by:
top in interface CompleteLattice
Returns:
an Object value

bottom

public java.lang.Object bottom()
The bottom element is (0,...,0).
Specified by:
bottom in interface CompleteLattice
Returns:
an Object value

main

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