All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calypso.util.tasc.OrderedList

java.lang.Object
   |
   +----calypso.util.tasc.OrderedList

public class OrderedList
extends Object
Ordered list class. An ordered list is a double-linked list that is optimized for insertion and erasure at arbitary points in the structure. The list elements must implement the COM.objectspace.jgl.UnaryPredicate interface and they must implement the same class or interface, so that they can be compared with each other.

Author:
Petteri Koponen
See Also:
DList, UnaryPredicate

Variable Index

 o _list
A double-linked list holding the elements.

Constructor Index

 o OrderedList()
Constructs myself to be an empty OrderedList.
 o OrderedList(OrderedList)
Construct myself to be a shallow copy of an existing OrderedList.

Method Index

 o back()
Returns the last element of the list.
 o clean()
Removes all elements from the list.
 o clone()
Returns a copy of myself.
 o elements()
Returns an Enumeration of my elements.
 o equals(Object)
Returns true if I am equal to some object.
 o equals(OrderedList)
Returns true if I am equal to another OrderedList.
 o front()
Returns the first element of the list.
 o isEmpty()
Returns true if I am empty.
 o pop()
Pops an object.
 o push(UnaryPredicate)
Pushes an object.
 o remove(Object)
Removes all references to a given element.
 o remove(Object, int)
Removes at most a particular number of references to a given element.
 o size()
Returns the number of elements I contain.
 o toString()
Returns a string representing myself.

Variables

 o _list
 DList _list
A double-linked list holding the elements.

Constructors

 o OrderedList
 public OrderedList()
Constructs myself to be an empty OrderedList.

 o OrderedList
 public OrderedList(OrderedList other_)
Construct myself to be a shallow copy of an existing OrderedList.

Parameters:
other_ - The existing OrderedList.

Methods

 o clone
 public synchronized Object clone()
Returns a copy of myself.

Returns:
A copy of myself.
Overrides:
clone in class Object
 o toString
 public String toString()
Returns a string representing myself.

Returns:
A string representing myself.
Overrides:
toString in class Object
 o elements
 public Enumeration elements()
Returns an Enumeration of my elements.

Returns:
An Enumeration of my elements.
 o equals
 public synchronized boolean equals(Object object_)
Returns true if I am equal to some object.

Parameters:
object_ - An object to be compared with.
Returns:
true if I am equal to the object.
Overrides:
equals in class Object
 o equals
 public synchronized boolean equals(OrderedList other_)
Returns true if I am equal to another OrderedList.

Parameters:
orderedList_ - An OrderedList to be compared with.
Returns:
true if I am equal to the the OrderedList.
 o size
 public final int size()
Returns the number of elements I contain.

Returns:
The number of elements I contain.
 o isEmpty
 public final boolean isEmpty()
Returns true if I am empty.

Returns:
true if I am empty.
 o push
 public final synchronized void push(UnaryPredicate object_)
Pushes an object. Lets the inserted object compare itself with my elements and inserts the object before the first element whose comparison returns true or at the end of the list. This operation always succeeds.

Parameters:
object_ - An object to be pushed.
 o pop
 public Object pop() throws InvalidOperationException
Pops an object. Removes and return the last element of the list.

Returns:
The first element of the list.
 o front
 public Object front() throws InvalidOperationException
Returns the first element of the list. Note that this does not remove the element.

Returns:
The first element of the list.
 o back
 public Object back() throws InvalidOperationException
Returns the last element of the list. Note that this does not remove the element.

Returns:
The last element of the list.
 o remove
 public int remove(Object object_)
Removes all references to a given element.

Parameters:
object_ - An object to be removed.
Returns:
The number of objects removed (0 - n).
 o remove
 public int remove(Object object_,
                   int number_)
Removes at most a particular number of references to a given element.

Parameters:
object_ - An object to be removed.
number_ - The number of objects to be removed.
Returns:
The number of objects removed (0 - number_).
 o clean
 public void clean()
Removes all elements from the list.


All Packages  Class Hierarchy  This Package  Previous  Next  Index