jade.util.leap
Class RoundList

java.lang.Object
  |
  +--jade.util.leap.RoundList

public class RoundList
extends java.lang.Object
implements Serializable

Implementation of a RoundList with get/insert methods relative to the current element

Version:
$Date: 2002/12/11 09:36:39 $ $Revision: 1.3 $
Author:
Fabio Bellifemine - TILab
See Also:
Serialized Form

Constructor Summary
RoundList()
           
 
Method Summary
 boolean add(java.lang.Object element)
          Inserts the element before the current element.
 boolean contains(java.lang.Object element)
          Returns true if this list contains the specified element.
 java.lang.Object get()
          Returns the current element in the list and updates the pointer such that the current becomes the next element in the list.
 Iterator iterator()
          Returns an Iterator over the elements in this list.
static void main(java.lang.String[] args)
          Just for Debugging this implementation.
 boolean remove(java.lang.Object element)
          Removes the first occurrence of the specified element in this list and updates the pointer to the current element.
 int size()
          Returns the number of elements in this list.
 java.lang.String toString()
          Returns a string representation of this collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoundList

public RoundList()
Method Detail

add

public boolean add(java.lang.Object element)
Inserts the element before the current element. If the list was empty, the inserted element becomes also the current element. Note that this implementation uses a LinkedList and therefore it is not synchronized.
Parameters:
element - the element to insert
Returns:
true (as per the general contract of Collection.add).

get

public java.lang.Object get()
                     throws java.util.NoSuchElementException
Returns the current element in the list and updates the pointer such that the current becomes the next element in the list.
Notice that if the list contains just 1 element each call to this method will return the same element.
Take care in avoiding infinite loops in calling this method. It must be called no more than size() times
Throws:
java.util.NoSuchElementException - if the list is empty

remove

public boolean remove(java.lang.Object element)
Removes the first occurrence of the specified element in this list and updates the pointer to the current element. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (element==null ? get(i)==null : element.equals(get(i))) (if such an element exists).
Parameters:
element - the element to be removed from this list, if present.
Returns:
true if the list contained the specified element.

contains

public boolean contains(java.lang.Object element)
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (element==null ? e==null : element.equals(e)).
Parameters:
element - whose presence in this list is to be tested.
Returns:
true if this list contains the specified element.

size

public int size()
Returns the number of elements in this list.
Returns:
the number of elements in this list.

iterator

public Iterator iterator()
Returns an Iterator over the elements in this list.
Returns:
an Iterator over the elements in this list.

toString

public java.lang.String toString()
Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its get() method, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String.valueOf(Object).
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this list

main

public static void main(java.lang.String[] args)
Just for Debugging this implementation.