|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.joensuu.cs.tra.TraLinkedList
Field Summary | |
---|---|
static ListNode |
EOL
Denotes the end of the list. |
Constructor Summary | |
---|---|
TraLinkedList()
Creates an empty list. |
Method Summary | |
---|---|
ListNode<E> |
first()
Returns the first node of this list. |
ListNode<E> |
getNext(ListNode<E> node)
Returns the specified ListNode s next
ListNode or null if none exists. |
ListNode<E> |
getPrevious(ListNode<E> node)
Returns the specified ListNode s previous
ListNode or null if none exists. |
ListNode<E> |
insert(ListNode<E> node,
E element)
Inserts a new ListNode with the specified
elementin front of the specified
ListNode . |
ListNode<E> |
insert(ListNode<E> node,
ListNode<E> newNode)
Inserts a ListNode in front of the specified
ListNode . |
boolean |
isEmpty()
Returns true if this list is empty. |
ListNode<E> |
last()
Returns the last node of this list. |
ListNode<E> |
remove(ListNode<E> node)
Removes a ListNode from this
TraLinkedList . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ListNode EOL
Constructor Detail |
---|
public TraLinkedList()
Method Detail |
---|
public boolean isEmpty()
ListNode
s.public ListNode<E> first()
ListNode
of this list or
null if this list is empty.public ListNode<E> last()
ListNode
of this list or
null if this list is empty.public ListNode<E> insert(ListNode<E> node, ListNode<E> newNode)
ListNode
in front of the specified
ListNode
. If node is
EOL
,
the ListNode
will be inserted at the end of
the TraLinkedList
.
node
- the ListNode
in front of which
newNode will be inserted. If node is
EOL
, node
will be inserted at the end of the
TraLinkedList
.newNode
- the ListNode
to be inserted.
ListNode
NullPointerException
- if node or newNode is
null.public ListNode<E> insert(ListNode<E> node, E element)
ListNode
with the specified
elementin front of the specified
ListNode
. If node is
EOL
,
the ListNode
will be inserted at the end of
the TraLinkedList
.
node
- the ListNode
in front of which
newNode will be inserted. If node is
EOL
, node
will be inserted at the end of the
TraLinkedList
.element
- the element for the new ListNode
ListNode
NullPointerException
- if node is null.public ListNode<E> remove(ListNode<E> node)
ListNode
from this
TraLinkedList
.
node
- the ListNode
to be removed.
ListNode
.
NullPointerException
- if node is null.
IllegalArgumentException
- if node is
EOL
.public ListNode<E> getNext(ListNode<E> node)
ListNode
s next
ListNode
or null if none exists.
node
- the ListNode
the next
ListNode
of which is to be returned.
ListNode
of node
or null if none exists.
NullPointerException
- if node is null.public ListNode<E> getPrevious(ListNode<E> node)
ListNode
s previous
ListNode
or null if none exists.
node
- the ListNode
the previous
ListNode
of which is to be returned.
ListNode
of node
or null if none exists.
NullPointerException
- if node is null.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |