structure
Class DoublyLinkedNode

java.lang.Object
  extended by structure.DoublyLinkedNode

public class DoublyLinkedNode
extends java.lang.Object

A private class implementing the element of a doubly linked list.

See Also:
DoublyLinkedList

Field Summary
protected  java.lang.Object data
          The actual value stored within element; provided by user.
protected  DoublyLinkedNode nextElement
          The reference of element following.
protected  DoublyLinkedNode previousElement
          The reference to element preceding.
 
Constructor Summary
DoublyLinkedNode(java.lang.Object v)
          Construct a doubly linked list element containing a value.
DoublyLinkedNode(java.lang.Object v, DoublyLinkedNode next, DoublyLinkedNode previous)
          Construct a doubly linked list element.
 
Method Summary
 boolean equals(java.lang.Object other)
          Determine if this element equal to another.
 int hashCode()
          Generate hash code associated with the element.
 DoublyLinkedNode next()
          Access the reference to the next value.
 DoublyLinkedNode previous()
          Get a reference to the previous element of the list.
 void setNext(DoublyLinkedNode next)
          Set reference to the next element.
 void setPrevious(DoublyLinkedNode previous)
          Set the reference to the previous element.
 void setValue(java.lang.Object value)
          Set the value of the element.
 java.lang.String toString()
          Construct a string representation of the element.
 java.lang.Object value()
          Get value stored within the element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.lang.Object data
The actual value stored within element; provided by user.


nextElement

protected DoublyLinkedNode nextElement
The reference of element following.


previousElement

protected DoublyLinkedNode previousElement
The reference to element preceding.

Constructor Detail

DoublyLinkedNode

public DoublyLinkedNode(java.lang.Object v,
                        DoublyLinkedNode next,
                        DoublyLinkedNode previous)
Construct a doubly linked list element.

Parameters:
v - The value associated with the element.
next - The reference to the next element.
previous - The reference to the previous element.

DoublyLinkedNode

public DoublyLinkedNode(java.lang.Object v)
Construct a doubly linked list element containing a value. Not part of any list (references are null).

Parameters:
v - The value referenced by this element.
Postcondition:
constructs a single element
Method Detail

next

public DoublyLinkedNode next()
Access the reference to the next value.

Returns:
Reference to the next element of the list.
Postcondition:
returns the element that follows this

previous

public DoublyLinkedNode previous()
Get a reference to the previous element of the list.

Returns:
Reference to the previous element.
Postcondition:
returns element that precedes this

value

public java.lang.Object value()
Get value stored within the element.

Returns:
The reference to the value stored.
Postcondition:
returns value stored here

setNext

public void setNext(DoublyLinkedNode next)
Set reference to the next element.

Parameters:
next - The reference to the new next element.
Postcondition:
sets value associated with this element

setPrevious

public void setPrevious(DoublyLinkedNode previous)
Set the reference to the previous element.

Parameters:
previous - The new previous element.
Postcondition:
establishes a new reference to a previous value

setValue

public void setValue(java.lang.Object value)
Set the value of the element.

Parameters:
value - The new value associated with the element.
Postcondition:
sets a new value for this object

equals

public boolean equals(java.lang.Object other)
Determine if this element equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
other - The other doubly linked list element.
Returns:
True iff the values within elements are the same.
Postcondition:
returns true if this object and other are equal

hashCode

public int hashCode()
Generate hash code associated with the element.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code associated with the value in element.
Postcondition:
generates hash code for element

toString

public java.lang.String toString()
Construct a string representation of the element.

Overrides:
toString in class java.lang.Object
Returns:
The string representing element.
Postcondition:
returns string representation of element