Class DoubleListNode<E>

java.lang.Object
  extended by DoubleListNode<E>

public class DoubleListNode<E>
extends Object

A class that represents a node to be used in a linked list. These nodes are doubly linked.

Version:
July 25, 2005

Constructor Summary
DoubleListNode()
          default constructor.
DoubleListNode(DoubleListNode<E> prev, E data, DoubleListNode<E> next)
          create a DoubleListNode that holds the specified data and refers to the specified next and previous elements.
 
Method Summary
 E getData()
          return the data in this node.
 DoubleListNode<E> getNext()
          return the DoubleListNode this ListNode refers to.
 DoubleListNode<E> getPrev()
          return the DoubleListNode this DoubleListNode refers to.
 void setData(E data)
          set the data in this node.
 void setNext(DoubleListNode<E> next)
          set the next node this DoubleListNode refers to.
 void setPrev(DoubleListNode<E> prev)
          set the previous node this DoubleListNode refers to.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleListNode

public DoubleListNode()
default constructor.
pre: none
post: getData() = null, getNext() = null, getPrev() = null
O(1)


DoubleListNode

public DoubleListNode(DoubleListNode<E> prev,
                      E data,
                      DoubleListNode<E> next)
create a DoubleListNode that holds the specified data and refers to the specified next and previous elements.
pre: none
post: getData() = item, getNext() = next, getPrev() = prev
O(1)

Parameters:
prev - the previous node
item - the data this DoubleListNode should hold
next - the next node
Method Detail

getData

public E getData()
return the data in this node.
pre: none
O(1)

Returns:
the data this DoubleListNode holds

getNext

public DoubleListNode<E> getNext()
return the DoubleListNode this ListNode refers to.
pre: none
O(1)

Returns:
the DoubleListNode this DoubleListNode refers to (normally the next one in a list)

getPrev

public DoubleListNode<E> getPrev()
return the DoubleListNode this DoubleListNode refers to.
pre: none
O(1)

Returns:
the DoubleListNode this DoubleListNode refers to (normally the previous one in a list)

setData

public void setData(E data)
set the data in this node. The old data is over written.
pre: none
post: getData() == data
O(1)

Parameters:
data - the new data for this DoubleListNode to hold

setNext

public void setNext(DoubleListNode<E> next)
set the next node this DoubleListNode refers to.
pre: none
post: getNext() = next
O(1)

Parameters:
next - the next node this DoubleListNode should refer to

setPrev

public void setPrev(DoubleListNode<E> prev)
set the previous node this DoubleListNode refers to.
pre: none
post: getPrev() = next
O(1)

Parameters:
prev - the previous node this DoubleListNode should refer to