Opus5
Class ChainedScatterTable

java.lang.Object
  |
  +--Opus5.AbstractObject
        |
        +--Opus5.AbstractContainer
              |
              +--Opus5.AbstractSearchableContainer
                    |
                    +--Opus5.AbstractHashTable
                          |
                          +--Opus5.ChainedScatterTable
All Implemented Interfaces:
Comparable, Container, HashTable, SearchableContainer

public class ChainedScatterTable
extends AbstractHashTable

A chained hash table implemented using an array.

Version:
$Id: ChainedScatterTable.java,v 3.2 1998/07/28 02:24:04 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.
See Also:
HashTable

Inner Class Summary
protected static class ChainedScatterTable.Entry
          Entry data structure
 
Field Summary
protected  ChainedScatterTable.Entry[] array
          An array of entries.
 
Fields inherited from class Opus5.AbstractContainer
count
 
Fields inherited from interface Opus5.HashTable
copyright
 
Constructor Summary
ChainedScatterTable(int length)
          Constructs a ChainedScatterTable with the specified length.
 
Method Summary
 void accept(Visitor visitor)
          Accepts the specified visitor and makes it visit all the objects in this chained scatter table.
protected  int compareTo(Comparable arg)
          Compares this chained scatter table with the specified comparable object.
 Comparable find(Comparable object)
          Finds an object in this chained scatter table that matches the specified object.
 Enumeration getEnumeration()
          Returns an enumeration that enumerates the objects in this chained scatter table.
 int getLength()
          Returns the lenght of this chained scatter table.
 void insert(Comparable object)
          Inserts the specified comparable object into this chained scatter table.
 boolean isFull()
          Tests if this chained scatter table is full.
 boolean isMember(Comparable object)
          Tests whether the specified object is contained in this chained scatter table.
 void purge()
          Purges this chained scatter table, making it empty.
 void withdraw(Comparable object)
          Withdraws the specified object from this chained scatter table.
 
Methods inherited from class Opus5.AbstractHashTable
f, g, getLoadFactor, h
 
Methods inherited from class Opus5.AbstractContainer
getCount, hashCode, isEmpty, toString
 
Methods inherited from class Opus5.AbstractObject
compare, 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
getCount, isEmpty
 
Methods inherited from interface Opus5.Comparable
compare, isEQ, isGE, isGT, isLE, isLT, isNE
 

Field Detail

array

protected ChainedScatterTable.Entry[] array
An array of entries.
Constructor Detail

ChainedScatterTable

public ChainedScatterTable(int length)
Constructs a ChainedScatterTable with the specified length.
Parameters:
length - The desired length.
Method Detail

getLength

public int getLength()
Returns the lenght of this chained scatter table.
Overrides:
getLength in class AbstractHashTable
Returns:
the lenght of this chained scatter table.

purge

public void purge()
Purges this chained scatter table, making it empty.

isFull

public boolean isFull()
Tests if this chained scatter table is full.
Overrides:
isFull in class AbstractContainer
Returns:
True if this chained scatter table is full; false otherwise.

accept

public void accept(Visitor visitor)
Accepts the specified visitor and makes it visit all the objects in this chained scatter table.
Overrides:
accept in class AbstractContainer
Parameters:
visitor - The visitor to accept.

insert

public void insert(Comparable object)
Inserts the specified comparable object into this chained scatter table.
Parameters:
object - The object to insert.
Throws:
ContainerFullException - If this chained scatter table is full.

find

public Comparable find(Comparable object)
Finds an object in this chained scatter table that matches the specified object.
Parameters:
object - The object to match.
Returns:
The object in this chained scatter table that matches the specified object; null if no match.

withdraw

public void withdraw(Comparable object)
Withdraws the specified object from this chained scatter table.
Parameters:
object - The object to be withdrawn.
Throws:
ContainerEmptyException - If this chained scatter table is empty.
java.lang.IllegalArgumentException - If the specified object is not in this chained scatter table.

isMember

public boolean isMember(Comparable object)
Tests whether the specified object is contained in this chained scatter table.
Parameters:
object - The object for which to look.
Returns:
True if the specified object is in this chained scatter table; false otherwise.

getEnumeration

public Enumeration getEnumeration()
Returns an enumeration that enumerates the objects in this chained scatter table.
Returns:
An enumeration that enumerates the objects in this chained scatter table.

compareTo

protected int compareTo(Comparable arg)
Compares this chained scatter table with the specified comparable object. This method is not implemented.
Overrides:
compareTo in class AbstractObject
Parameters:
arg - The object with which this chained scatter table is compared.
Throws:
MethodNotImplemented - Always.