Opus5
Class AbstractSet

java.lang.Object
  |
  +--Opus5.AbstractObject
        |
        +--Opus5.AbstractContainer
              |
              +--Opus5.AbstractSearchableContainer
                    |
                    +--Opus5.AbstractSet
All Implemented Interfaces:
Comparable, Container, SearchableContainer
Direct Known Subclasses:
MultisetAsArray, MultisetAsLinkedList, PartitionAsForest, PartitionAsForest.PartitionTree, SetAsArray, SetAsBitVector

public abstract class AbstractSet
extends AbstractSearchableContainer

The AbstractSet class is the base class from which all concrete set and multiset classes are derived. This abstract class provides default implementations for various methods declared in the Set interface.

Version:
$Id: AbstractSet.java,v 3.2 1998/07/28 12:02:38 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.
See Also:
Set, Multiset

Field Summary
protected  int universeSize
          The size of the universal set.
 
Fields inherited from class Opus5.AbstractContainer
count
 
Fields inherited from interface Opus5.SearchableContainer
copyright
 
Constructor Summary
AbstractSet(int universeSize)
          Constructs an AbstractSet with the specified size of universal set.
 
Method Summary
 Comparable find(Comparable object)
          Not a valid operation on sets or multisets.
 void insert(Comparable object)
          Inserts the specified comparable object into this set.
protected abstract  void insert(int i)
          Inserts the specified integer into this set.
 boolean isMember(Comparable object)
          Tests whether the specified object is a member of this set.
protected abstract  boolean isMember(int i)
          Tests whether the specified integer is a member of this set.
 void withdraw(Comparable object)
          Withdraws the specified comparable object from this set.
protected abstract  void withdraw(int i)
          Withdraws the specified integer from this set.
 
Methods inherited from class Opus5.AbstractContainer
accept, getCount, hashCode, isEmpty, isFull, toString
 
Methods inherited from class Opus5.AbstractObject
compare, compareTo, equals, isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Opus5.Container
accept, getCount, getEnumeration, isEmpty, isFull, purge
 
Methods inherited from interface Opus5.Comparable
compare, isEQ, isGE, isGT, isLE, isLT, isNE
 

Field Detail

universeSize

protected int universeSize
The size of the universal set.
Constructor Detail

AbstractSet

public AbstractSet(int universeSize)
Constructs an AbstractSet with the specified size of universal set.
Parameters:
universeSize - The specified size of universal set.
Method Detail

insert

protected abstract void insert(int i)
Inserts the specified integer into this set.
Parameters:
i - The integer to insert.

withdraw

protected abstract void withdraw(int i)
Withdraws the specified integer from this set.
Parameters:
i - The integer to withdraw.

isMember

protected abstract boolean isMember(int i)
Tests whether the specified integer is a member of this set.
Parameters:
i - The integer for which to search.

insert

public void insert(Comparable object)
Inserts the specified comparable object into this set. The object must be an instance of the Int class.
Parameters:
object - The object to insert into this set.
Throws:
ClassCastException - If the object is not an Int.
See Also:
Int

withdraw

public void withdraw(Comparable object)
Withdraws the specified comparable object from this set. The object must be an instance of the Int class.
Parameters:
object - The object to withdraw from this set.
Throws:
ClassCastException - If the object is not an Int.
See Also:
Int

isMember

public boolean isMember(Comparable object)
Tests whether the specified object is a member of this set. The object must be an instance of the Int class.
Parameters:
object - The object for which to search.
Throws:
ClassCastException - If the object is not an Int.
See Also:
Int

find

public Comparable find(Comparable object)
Not a valid operation on sets or multisets.
Parameters:
object - Ignored.
Throws:
InvalidOperationException - Always.