jgroup.util
Class OrderedList

java.lang.Object
  extended by jgroup.util.OrderedList
Direct Known Subclasses:
BindingList

public class OrderedList
extends java.lang.Object

The OrderedList class represents an ordered collection of objects. The order of elements is based on their keys, represented as integer values.

Since:
Jgroup 1.0
Author:
Alberto Montresor
See Also:
BindingList

Field Summary
 int key
          The identifier of this element
protected  OrderedList next
          Reference to the next element
 
Constructor Summary
protected OrderedList()
          Creates an empty list.
 
Method Summary
 int count()
          Count the number of elements in the list
 OrderedList getFirst()
          Returns the first element of the OrderedList
 OrderedList getNext()
          Returns the next element in the OrderedList.
 boolean insert(OrderedList object)
          Inserts the specified element in the OrderedList.
 boolean isEmpty()
          Returns true if this OrderedList contains no elements.
 OrderedList lookup(int key)
          Returns the first occurrence in this OrderedList of a element with the specified key, or null if the element is not found.
 OrderedList remove(int key)
          Removes the first occurrence of an element with the specified key in this OrderedList.
 void removeAll(int key)
           
 OrderedList removeFirst()
          Removes and returns the first element of the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

public int key
The identifier of this element


next

protected OrderedList next
Reference to the next element

Constructor Detail

OrderedList

protected OrderedList()
Creates an empty list.

Method Detail

insert

public boolean insert(OrderedList object)
Inserts the specified element in the OrderedList. If the object's key is already present in the OrderedList, the element is not inserted.

Parameters:
object - The element to be inserted in this OrderedList.
Returns:
True if the object has previously been inserted; false otherwise.

remove

public OrderedList remove(int key)
Removes the first occurrence of an element with the specified key in this OrderedList. If the OrderedList does not contain the element, it is unchanged and the methods returns null.

Parameters:
key - the key to search for.

removeAll

public void removeAll(int key)
Parameters:
key - the key to search for.

removeFirst

public OrderedList removeFirst()
Removes and returns the first element of the list. If the list is empty, null will be returned.


lookup

public OrderedList lookup(int key)
Returns the first occurrence in this OrderedList of a element with the specified key, or null if the element is not found.

Parameters:
key - the key to search for.

getNext

public OrderedList getNext()
Returns the next element in the OrderedList.


getFirst

public OrderedList getFirst()
Returns the first element of the OrderedList


isEmpty

public boolean isEmpty()
Returns true if this OrderedList contains no elements.


count

public int count()
Count the number of elements in the list



Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.