clarion.tools.linkedlist
Interface List

All Known Implementing Classes:
LinkedList

public interface List


Method Summary
 int getCount()
          Counts the number of elements in the list.
 java.lang.Object getFrom(int index)
          Returns the element at the specified position in the list.
 java.lang.Object getHead()
          Returns the first element in the list.
 java.lang.Object getTail()
          Returns the last element in the list.
 void insertAt(java.lang.Object element, int index)
          Inserts an element at the specified position in the list.
 void insertHead(java.lang.Object element)
          Inserts an element at the beginning of the list.
 void insertTail(java.lang.Object element)
          Inserts an element at the end of the list.
 boolean isEmpty()
          Checks whether the list is empty.
 java.lang.Object removeFrom(int index)
          Removes from the list the element at the specified location.
 java.lang.Object removeHead()
          Removes the first element from the list.
 java.lang.Object removeTail()
          Removes the last element from the list.
 

Method Detail

isEmpty

public boolean isEmpty()
Checks whether the list is empty.

Returns:
true if the list is empty, false otherwise.

getCount

public int getCount()
Counts the number of elements in the list.

Returns:
the number of elements in the list.

getHead

public java.lang.Object getHead()
Returns the first element in the list.

Returns:
the first element in the list.

getTail

public java.lang.Object getTail()
Returns the last element in the list.

Returns:
the last element in the list.

getFrom

public java.lang.Object getFrom(int index)
Returns the element at the specified position in the list.

Parameters:
index - the index of the element to return.
Returns:
the element at the specified position.

insertHead

public void insertHead(java.lang.Object element)
Inserts an element at the beginning of the list.

Parameters:
element - the element to be inserted.

insertTail

public void insertTail(java.lang.Object element)
Inserts an element at the end of the list.

Parameters:
element - the element to be inserted.

insertAt

public void insertAt(java.lang.Object element,
                     int index)
Inserts an element at the specified position in the list.

Parameters:
element - the element to be inserted.
index - the position at which the element is to be inserted.

removeHead

public java.lang.Object removeHead()
Removes the first element from the list.

Returns:
the element that was first in the list.

removeTail

public java.lang.Object removeTail()
Removes the last element from the list.

Returns:
the element that was last in the list.

removeFrom

public java.lang.Object removeFrom(int index)
Removes from the list the element at the specified location.

Parameters:
index - the index of the element to be removed.
Returns:
the element that was at the specified location.