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.
|
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 java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
SortedListAsArray
public SortedListAsArray(int size)
- Constructs an
SortedListAsArray
with the specified array length
- Parameters:
size - The desired array length.
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.