fi.joensuu.cs.tra
Class ListNode<E>

java.lang.Object
  extended by fi.joensuu.cs.tra.ListNode<E>
Direct Known Subclasses:
EOL

public class ListNode<E>
extends Object

ListNodes are the building blocks of the TraLinkedLists. They are basically just wrappers for the elements in addition to in a sense marking the position in a TraLinkedList. A special case of ListNodes is the fi.joensuu.cs.tra.EOL which marks the end of the list and cannot be operated on with the exception of using it as the positional parameter when inserting a node at the end of the list. The next() and previous() methods can also be called from TraLinkedList. The methods setElement() and getElement() should be rather self-explanatory.


Method Summary
 E getElement()
          Returns this ListNode's element.
 ListNode<E> next()
          Returns this ListNode's next node.
 ListNode<E> previous()
          Returns this ListNode's previous node.
 String toString()
          Returns the element's toString().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getElement

public E getElement()
Returns this ListNode's element.

Returns:
this node's element or null if none.

next

public ListNode<E> next()
Returns this ListNode's next node.

Returns:
this node's next node or EOL if none.
Throws:
TraLinkedListException - if this node is TraLinkedList.EOL.

previous

public ListNode<E> previous()
Returns this ListNode's previous node.

Returns:
this node's previous node or null if none.

toString

public String toString()
Returns the element's toString().

Overrides:
toString in class Object