Opus5
Class SortedListAsArray

java.lang.Object
  |
  +--Opus5.AbstractObject
        |
        +--Opus5.AbstractContainer
              |
              +--Opus5.AbstractSearchableContainer
                    |
                    +--Opus5.OrderedListAsArray
                          |
                          +--Opus5.SortedListAsArray
All Implemented Interfaces:
Comparable, Container, OrderedList, SearchableContainer, SortedList

public class SortedListAsArray
extends OrderedListAsArray
implements SortedList

A sorted list implemented using an array.

Version:
$Id: SortedListAsArray.java,v 3.4 1998/07/29 14:50:08 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.

Inner classes inherited from class Opus5.OrderedListAsArray
OrderedListAsArray.MyCursor
 
Fields inherited from class Opus5.OrderedListAsArray
array
 
Fields inherited from class Opus5.AbstractContainer
count
 
Fields inherited from interface Opus5.SortedList
copyright
 
Fields inherited from interface Opus5.OrderedList
copyright
 
Constructor Summary
SortedListAsArray(int size)
          Constructs an SortedListAsArray with the specified array length
 
Method Summary
 Comparable find(Comparable object)
          Finds an object in this sorted list that matches the specified object.
protected  int findOffset(Comparable object)
          Finds the position in this sorted list of a comparable object that matches the specified comparable object.
 Cursor findPosition(Comparable object)
          Returns the position of an object in this sorted list that matches the specified object.
 void insert(Comparable object)
          Inserts the specified object into this sorted list.
 void withdraw(Comparable object)
          Withdraws the specified object from this sorted list.
 
Methods inherited from class Opus5.OrderedListAsArray
accept, compareTo, get, getEnumeration, isFull, isMember, purge
 
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.SortedList
get
 
Methods inherited from interface Opus5.SearchableContainer
isMember
 
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
 

Constructor Detail

SortedListAsArray

public SortedListAsArray(int size)
Constructs an SortedListAsArray with the specified array length
Parameters:
size - The desired array length.
Method Detail

insert

public void insert(Comparable object)
Inserts the specified object into this sorted list.
Specified by:
insert in interface SearchableContainer
Overrides:
insert in class OrderedListAsArray
Parameters:
object - The object to insert.
Throws:
ContainerFullException - If this sorted list is full.

findOffset

protected int findOffset(Comparable object)
Finds the position in this sorted list of a comparable object that matches the specified comparable object.
Parameters:
object - The object to match.
Returns:
The position in this sorted list of the matching object; -1 if no match is found.

find

public Comparable find(Comparable object)
Finds an object in this sorted list that matches the specified object.
Specified by:
find in interface SearchableContainer
Overrides:
find in class OrderedListAsArray
Parameters:
arg - The object to match.
Returns:
The object in this list that matches the specified object; null if no match is found.

findPosition

public Cursor findPosition(Comparable object)
Returns the position of an object in this sorted list that matches the specified object.
Specified by:
findPosition in interface SortedList
Overrides:
findPosition in class OrderedListAsArray
Parameters:
object - The object to match.
Returns:
The position in this list of the matching object.

withdraw

public void withdraw(Comparable object)
Withdraws the specified object from this sorted list.
Specified by:
withdraw in interface SearchableContainer
Overrides:
withdraw in class OrderedListAsArray
Parameters:
objet - The object to be withdrawn.
Throws:
ContainerEmptyException - If this sorted list is empty.
java.lang.IllegalArgumentException - If object is not in this list.