de.rwth.domains.templates
Class SimpleSet

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

public class SimpleSet
extends java.lang.Object
implements Set

Class for the creation of simple sets by explicitly providing all elements.

Version:
$Id: SimpleSet.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[] elements
          Contains all elements of this set.
 
Constructor Summary
SimpleSet()
          Creates the empty set.
SimpleSet(int i)
          Creates a set with one int as element.
SimpleSet(int[] is)
          Creates a set from an array of ints.
SimpleSet(int from, int to)
          Creates a set with a range of elements.
SimpleSet(java.lang.Object o)
          Creates a set with one element.
SimpleSet(java.lang.Object[] os)
          Creates a set from an array of Objects.
 
Method Summary
 boolean equals(java.lang.Object e1, java.lang.Object e2)
          Checks if two objects are equal.
 boolean isElement(java.lang.Object e)
          Checks if an Object 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.
 long size()
          Returns the size of this set.
 long sizeSkel()
          Returns the size of the skeleton subset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected java.lang.Object[] elements
Contains all elements of this set.
Constructor Detail

SimpleSet

public SimpleSet()
Creates the empty set.

SimpleSet

public SimpleSet(java.lang.Object[] os)
Creates a set from an array of Objects.
Parameters:
os - all the elements of the new set.

SimpleSet

public SimpleSet(java.lang.Object o)
Creates a set with one element.
Parameters:
o - the Object which will be the element of the new set.

SimpleSet

public SimpleSet(int i)
Creates a set with one int as element.
Parameters:
i - the int which will be the element of the new set.

SimpleSet

public SimpleSet(int from,
                 int to)
Creates a set with a range of elements.
Parameters:
from - the first element of the set
to - the last element of the set

SimpleSet

public SimpleSet(int[] is)
Creates a set from an array of ints.
Parameters:
is - all the elements of the new set.
Method Detail

isElement

public boolean isElement(java.lang.Object e)
Checks if an Object is contained in this set. It uses the method equals(java.lang.Object, java.lang.Object) with the parameter e as second parameter to check for equality.
Specified by:
isElement in interface Set
Parameters:
e - a value of type Object
Returns:
a value of type boolean

equals

public boolean equals(java.lang.Object e1,
                      java.lang.Object e2)
Checks if two objects are equal.
Specified by:
equals in interface Set
Parameters:
e1 - a value of type Object
e2 - a value of type Object
Returns:
a value of type boolean

iterator

public java.util.Iterator iterator()
Returns an Iterator of the elements of this set.
Specified by:
iterator in interface Set
Returns:
an Iterator of all elements of this set.

size

public long size()
Returns the size of this set.
Specified by:
size in interface Set
Returns:
the number of elements

sizeSkel

public long sizeSkel()
Returns the size of the skeleton subset. This is the same as size().
Specified by:
sizeSkel in interface Set
Returns:
the number of elements in the skeleton subset.

iteratorSkel

public java.util.Iterator iteratorSkel()
Returns an Iterator of the elements of the skeleton subset of this set. This is the same as iterator.
Specified by:
iteratorSkel in interface Set
Returns:
an Iterator of all elements of the skeleton of this set.