de.rwth.domains.templates
Class TupleSet

java.lang.Object
  |
  +--de.rwth.domains.templates.TupleSet
All Implemented Interfaces:
Set
Direct Known Subclasses:
TuplePOSet

public class TupleSet
extends java.lang.Object
implements Set

Class for the creation of sets consisting of tuples from elements of other sets (Cartesian product).

Version:
$Id: TupleSet.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  Set[] sets
          All the component Sets of this set.
protected  long size
          The size of this set.
protected  long sizeSkel
          The size of the skeleton of this set.
 
Constructor Summary
TupleSet(Set[] sets)
          Creates a TupleSet from an array of Sets.
TupleSet(Set set1, Set set2)
          Creates a TupleSet from two Sets.
 
Method Summary
 boolean equals(java.lang.Object e1, java.lang.Object e2)
          Checks if two elements of this set are equal.
 Set[] getSets()
          Returns clones of the component set.
 boolean isElement(java.lang.Object e)
          Checks if an element is contained in this 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 of this set.
static void main(java.lang.String[] args)
          Mini test environment.
 long size()
          Returns the size of this set.
 long sizeSkel()
          Returns the size of the skeleton subset of this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sets

protected Set[] sets
All the component Sets of this set.

size

protected long size
The size of this set.

sizeSkel

protected long sizeSkel
The size of the skeleton of this set.
Constructor Detail

TupleSet

public TupleSet(Set[] sets)
Creates a TupleSet from an array of Sets.
Parameters:
sets - the component Sets

TupleSet

public TupleSet(Set set1,
                Set set2)
Creates a TupleSet from two Sets.
Parameters:
set1 - 1st component Set
set2 - 2nd component Set
Method Detail

isElement

public boolean isElement(java.lang.Object e)
Checks if an element is contained in this set.
Specified by:
isElement in interface Set
Parameters:
e - a value of type Object
Returns:
true iff e is TupleElement of matching length and each component of e is contained in the corresponding component Set of this Set.

equals

public boolean equals(java.lang.Object e1,
                      java.lang.Object e2)
Checks if two elements of this set are equal.
Specified by:
equals in interface Set
Parameters:
e1 - a value of type Object
e2 - a value of type Object
Returns:
true iff both e1 and e2 are TupleElements of matching length and the corresponding components of e1 and e2 are equal.

size

public long size()
Returns the size of this set.
Specified by:
size in interface Set
Returns:
the number of elements which is the product of sizes of the component sets.

iterator

public java.util.Iterator iterator()
Returns an Iterator of the elements of this set. The elements are all tuples resulting from combining the elements of the component sets.
Specified by:
iterator in interface Set
Returns:
an Iterator of all elements of this set.

sizeSkel

public long sizeSkel()
Returns the size of the skeleton subset of this set.
Specified by:
sizeSkel in interface Set
Returns:
the number of elements which is the product of sizes of the skeleton subsets of the component sets.

iteratorSkel

public java.util.Iterator iteratorSkel()
Returns an Iterator of the elements of the skeleton subset of this set. The elements are all tuples resulting from combining the elements of the skeleton subsets of the component sets.
Specified by:
iteratorSkel in interface Set
Returns:
an Iterator of all elements of this set.

getSets

public Set[] getSets()
Returns clones of the component set.
Returns:
a Set[] value

main

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