Opus5
Class OrderedListAsLinkedList
java.lang.Object
|
+--Opus5.AbstractObject
|
+--Opus5.AbstractContainer
|
+--Opus5.AbstractSearchableContainer
|
+--Opus5.OrderedListAsLinkedList
- All Implemented Interfaces:
- Comparable, Container, OrderedList, SearchableContainer
- Direct Known Subclasses:
- SortedListAsLinkedList
- public class OrderedListAsLinkedList
- extends AbstractSearchableContainer
- implements OrderedList
An ordered list implemented using a linked list.
- Version:
- $Id: OrderedListAsLinkedList.java,v 3.8 1998/09/20 18:20:57 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
|
Method Summary |
void |
accept(Visitor visitor)
Accepts the specified visitor and makes it visit
the objects in this ordered list in order. |
protected int |
compareTo(Comparable arg)
Compares this ordered list with the specified comparable object. |
Comparable |
find(Comparable arg)
Finds an object in this ordered list that matches the specified object. |
Cursor |
findPosition(Comparable arg)
Returns the position of an object in this ordered list
that matches the specified object. |
Comparable |
get(int offset)
Returns the object in this ordered list
found at the specified offset. |
Enumeration |
getEnumeration()
Returns an enumeration that enumerates the objects
in this ordered list in order. |
void |
insert(Comparable object)
Inserts the specified object into this ordered list. |
boolean |
isMember(Comparable object)
Tests whether the specified object is in this ordered list. |
void |
purge()
Purges this ordered list, making it empty. |
void |
withdraw(Comparable object)
Withdraws the specified object from this ordered list. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
linkedList
protected LinkedList linkedList
- The linked list.
OrderedListAsLinkedList
public OrderedListAsLinkedList()
- Constructs an empty
OrderedListAsLinkedList.
insert
public void insert(Comparable object)
- Inserts the specified object into this ordered list.
- Specified by:
insert in interface SearchableContainer
- Parameters:
object - The object to insert.
get
public Comparable get(int offset)
- Returns the object in this ordered list
found at the specified offset.
- Specified by:
get in interface OrderedList
- Parameters:
offset - The offset of the desired object.- Returns:
- The object at the specified offset.
purge
public void purge()
- Purges this ordered list, making it empty.
- Specified by:
purge in interface Container
accept
public void accept(Visitor visitor)
- Accepts the specified visitor and makes it visit
the objects in this ordered list in order.
- Specified by:
accept in interface Container- Overrides:
accept in class AbstractContainer
- Parameters:
visitor - The visitor to accept.
isMember
public boolean isMember(Comparable object)
- Tests whether the specified object is in this ordered list.
- Specified by:
isMember in interface SearchableContainer
- Parameters:
object - The object for which to look.- Returns:
- True if the specified object is in this list;
false otherwise.
find
public Comparable find(Comparable arg)
- Finds an object in this ordered list that matches the specified object.
- Specified by:
find in interface SearchableContainer
- Parameters:
arg - The object to match.- Returns:
- The object in this list that matches the specified object;
null if no match is found.
withdraw
public void withdraw(Comparable object)
- Withdraws the specified object from this ordered list.
- Specified by:
withdraw in interface SearchableContainer
- Parameters:
objet - The object to be withdrawn.- Throws:
ContainerEmptyException - If this ordered list is empty.java.lang.IllegalArgumentException - If object is not in this list.
findPosition
public Cursor findPosition(Comparable arg)
- Returns the position of an object in this ordered list
that matches the specified object.
- Specified by:
findPosition in interface OrderedList
- Parameters:
object - The object to match.- Returns:
- The position in this list of the matching object.
getEnumeration
public Enumeration getEnumeration()
- Returns an enumeration that enumerates the objects
in this ordered list in order.
- Specified by:
getEnumeration in interface Container
- Returns:
- An enumeration that enumerates the objects in this list.
compareTo
protected int compareTo(Comparable arg)
- Compares this ordered list with the specified comparable object.
This method is not impemented.
- Overrides:
compareTo in class AbstractObject
- Parameters:
arg - The comparable object with which to compare this ordered list.- Throws:
MethodNotImplemented - Always.