structure
Class DoublyLinkedListElement<ELTTYPE>

java.lang.Object
  extended by structure.DoublyLinkedListElement<ELTTYPE>

public class DoublyLinkedListElement<ELTTYPE>
extends java.lang.Object

A class supporting a doubly linked list element. Each element contains a value and maintains references to the previous and next nodes in the list.

See Also:
DoublyLinkedList

Constructor Summary
DoublyLinkedListElement(ELTTYPE v)
          Construct a doubly linked list element containing a value.
DoublyLinkedListElement(ELTTYPE v, DoublyLinkedListElement<ELTTYPE> next, DoublyLinkedListElement<ELTTYPE> 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.
 DoublyLinkedListElement<ELTTYPE> next()
          Access the reference to the next value.
 DoublyLinkedListElement<ELTTYPE> previous()
          Get a reference to the previous element of the list.
 void setNext(DoublyLinkedListElement<ELTTYPE> next)
          Set reference to the next element.
 void setPrevious(DoublyLinkedListElement<ELTTYPE> previous)
          Set the reference to the previous element.
 void setValue(ELTTYPE value)
          Set the value of the element.
 java.lang.String toString()
          Construct a string representation of the element.
 ELTTYPE value()
          Get value stored within the element.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoublyLinkedListElement

public DoublyLinkedListElement(ELTTYPE v,
                               DoublyLinkedListElement<ELTTYPE> next,
                               DoublyLinkedListElement<ELTTYPE> 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.

DoublyLinkedListElement

public DoublyLinkedListElement(ELTTYPE 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.
Post:
constructs a single element
Method Detail

next

public DoublyLinkedListElement<ELTTYPE> next()
Access the reference to the next value.

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

previous

public DoublyLinkedListElement<ELTTYPE> previous()
Get a reference to the previous element of the list.

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

value

public ELTTYPE value()
Get value stored within the element.

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

setNext

public void setNext(DoublyLinkedListElement<ELTTYPE> next)
Set reference to the next element.

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

setPrevious

public void setPrevious(DoublyLinkedListElement<ELTTYPE> previous)
Set the reference to the previous element.

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

setValue

public void setValue(ELTTYPE value)
Set the value of the element.

Parameters:
value - The new value associated with the element.
Post:
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.
Post:
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.
Post:
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.
Post:
returns string representation of element