planet.util
Class OrderedList

java.lang.Object
  extended byplanet.util.OrderedList
All Implemented Interfaces:
java.io.Serializable

public class OrderedList
extends java.lang.Object
implements java.io.Serializable

This class offers the ability of mantain a collection of objects ordered using an int value as order key.

Author:
Pedro Garcia, Jordi Pujol 14-jul-2005
See Also:
Serialized Form

Constructor Summary
OrderedList(java.lang.Object elem, int value)
          Builds an ordered list item with specified values.
 
Method Summary
 boolean contains(int value)
          Requests if exists the key value into the ordered value.
 java.lang.Object elem()
          Shows the saved data into this list item.
 java.lang.Object get(int value)
          Gets the saved data maped to the specified value.
 OrderedList insert(OrderedList elem)
          Inserts into the list the specified elem.
 OrderedList next()
          Shows the following list item.
 OrderedList pop()
          Gets the next element into the ordered list, or null if the current item is the last one.
 OrderedList prev()
          Shows the previous list item.
 int size()
          Returns the number of elements into the list.
 java.lang.String toString()
          Returns recursively all values saved into the current list.
 int value()
          Shows the key for the current list item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrderedList

public OrderedList(java.lang.Object elem,
                   int value)
Builds an ordered list item with specified values.

Parameters:
elem - Data to save.
value - Ordenation key.
Method Detail

insert

public OrderedList insert(OrderedList elem)
Inserts into the list the specified elem.

Parameters:
elem - OrderedList item to be inserted.
Returns:
The same instance once the elem has been inserted.

pop

public OrderedList pop()
Gets the next element into the ordered list, or null if the current item is the last one.

Returns:
The next element into the ordered list, or null if the current item is the last one.

get

public java.lang.Object get(int value)
Gets the saved data maped to the specified value.

Parameters:
value - The found order key.
Returns:
The saved data maped to the value or null if not exists the value into the whole ordered list.

contains

public boolean contains(int value)
Requests if exists the key value into the ordered value.

Parameters:
value - The key to be found.
Returns:
true if this key is found into the whole list.

size

public int size()
Returns the number of elements into the list.

Returns:
The number of elements into the list.

next

public OrderedList next()
Shows the following list item.

Returns:
The following list item.

prev

public OrderedList prev()
Shows the previous list item.

Returns:
The previous list item.

value

public int value()
Shows the key for the current list item.

Returns:
The key for the current list item.

elem

public java.lang.Object elem()
Shows the saved data into this list item.

Returns:
The saved data into this list item.

toString

public java.lang.String toString()
Returns recursively all values saved into the current list.

Returns:
String representation of this list.
See Also:
Object.toString()