de.rwth.domains.templates
Class SumSet

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

public class SumSet
extends java.lang.Object
implements Set

Class for the creation of sets as the sum of other sets. Warning: This will violate the set properties, the same element is contained in more than one component.

Version:
$Id: SumSet.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
          The sets contained in this set.
protected  long size
          Its size, which is the sum of the sizes of the component sets.
protected  long sizeSkel
          The size of the skeleton subset, which is the sum of the sizes of the skeleton subsets of the component sets.
 
Constructor Summary
SumSet(Set[] sets)
          Creates a new SumSet instance from an array of component sets.
SumSet(Set set1, Set set2)
          Creates a new SumSet instance from two component sets.
 
Method Summary
 boolean equals(java.lang.Object e1, java.lang.Object e2)
          Returns true, if the equality holds in at least one of the components of this set.
 boolean isElement(java.lang.Object e)
          Returns true, if the object is element of one of the components of this set.
 java.util.Iterator iterator()
          Returns an iterator, which will iterate over all component set iterators.
 java.util.Iterator iteratorSkel()
          Returns an iterator, which will iterate over all skeleton subset component set iterators.
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
The sets contained in this set.

size

protected long size
Its size, which is the sum of the sizes of the component sets. However, of one of the component sets in infinite, then this is -1.

sizeSkel

protected long sizeSkel
The size of the skeleton subset, which is the sum of the sizes of the skeleton subsets of the component sets. However, of one of these is -1, then this is -1 as well.
Constructor Detail

SumSet

public SumSet(Set[] sets)
Creates a new SumSet instance from an array of component sets.
Parameters:
sets - a Set[] value

SumSet

public SumSet(Set set1,
              Set set2)
Creates a new SumSet instance from two component sets.
Parameters:
set1 - a Set value
set2 - a Set value
Method Detail

equals

public boolean equals(java.lang.Object e1,
                      java.lang.Object e2)
Returns true, if the equality holds in at least one of the components of this set.
Specified by:
equals in interface Set
Parameters:
e1 - an Object value
e2 - an Object value
Returns:
a boolean value

isElement

public boolean isElement(java.lang.Object e)
Returns true, if the object is element of one of the components of this set.
Specified by:
isElement in interface Set
Parameters:
e - an Object value
Returns:
a boolean value

iterator

public java.util.Iterator iterator()
Returns an iterator, which will iterate over all component set iterators.
Specified by:
iterator in interface Set
Returns:
an Iterator value

size

public long size()
Description copied from interface: Set
Returns the size of this set.
Implementations should guarantee that it is the number of times iterator().hasNext() can be called.
Specified by:
size in interface Set
Following copied from interface: de.rwth.domains.Set
Returns:
-1 iff the set has infinite size, the number of elements otherwise.
See Also:
Domain.checkProperties(Set set)

sizeSkel

public long sizeSkel()
Description copied from interface: Set
Returns the size of the skeleton subset of this set.
Implementations should guarantee that it is the number of times iterator().hasNext() can be called.
Specified by:
sizeSkel in interface Set
Following copied from interface: de.rwth.domains.Set
Returns:
-1 iff there is no skeleton subset, the number of elements otherwise.
See Also:
Domain.checkProperties(Set set)

iteratorSkel

public java.util.Iterator iteratorSkel()
Returns an iterator, which will iterate over all skeleton subset component set iterators.
Specified by:
iteratorSkel in interface Set
Returns:
an Iterator value

main

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