structure
Class AbstractList

java.lang.Object
  extended by structure.AbstractStructure
      extended by structure.AbstractList
All Implemented Interfaces:
List, Structure
Direct Known Subclasses:
CircularList, DoublyLinkedList, SinglyLinkedList, Vector

public abstract class AbstractList
extends AbstractStructure
implements List


Constructor Summary
AbstractList()
          Default constructor for AbstractLists
 
Method Summary
 void add(java.lang.Object value)
          Add an object to tail of list.
 void addFirst(java.lang.Object value)
          Add a value to head of list.
 void addLast(java.lang.Object value)
          Add a value to tail of list.
 boolean contains(java.lang.Object value)
          Check to see if a value is in list.
 java.lang.Object get()
          Retrieves value from tail of list.
 java.lang.Object getFirst()
          Fetch first element of list.
 java.lang.Object getLast()
          Fetch last element of list.
 boolean isEmpty()
          Determine if list is empty.
 java.lang.Object remove()
          Removes value from tail of list.
 java.lang.Object removeFirst()
          Remove a value from first element of list.
 java.lang.Object removeLast()
          Remove last value from list.
 
Methods inherited from class structure.AbstractStructure
elements, hashCode, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface structure.List
add, clear, get, indexOf, iterator, lastIndexOf, remove, remove, set, size
 
Methods inherited from interface structure.Structure
elements, values
 

Constructor Detail

AbstractList

public AbstractList()
Default constructor for AbstractLists

Postcondition:
does nothing
Method Detail

isEmpty

public boolean isEmpty()
Determine if list is empty.

Specified by:
isEmpty in interface List
Specified by:
isEmpty in interface Structure
Overrides:
isEmpty in class AbstractStructure
Returns:
True if list has no elements.
Postcondition:
returns true iff list has no elements

addFirst

public void addFirst(java.lang.Object value)
Add a value to head of list.

Specified by:
addFirst in interface List
Parameters:
value - The value to be added to head of list.
Postcondition:
value is added to beginning of list

addLast

public void addLast(java.lang.Object value)
Add a value to tail of list.

Specified by:
addLast in interface List
Parameters:
value - The value to be added to tail of list.
Postcondition:
value is added to end of list

getFirst

public java.lang.Object getFirst()
Fetch first element of list.

Specified by:
getFirst in interface List
Returns:
A reference to first element of list.
Precondition:
list is not empty
Postcondition:
returns first value in list

getLast

public java.lang.Object getLast()
Fetch last element of list.

Specified by:
getLast in interface List
Returns:
A reference to last element of list.
Precondition:
list is not empty
Postcondition:
returns last value in list

removeFirst

public java.lang.Object removeFirst()
Remove a value from first element of list.

Specified by:
removeFirst in interface List
Returns:
value actually removed.
Precondition:
list is not empty
Postcondition:
removes first value from list

removeLast

public java.lang.Object removeLast()
Remove last value from list.

Specified by:
removeLast in interface List
Returns:
value actually removed.
Precondition:
list is not empty
Postcondition:
removes last value from list

add

public void add(java.lang.Object value)
Add an object to tail of list.

Specified by:
add in interface List
Specified by:
add in interface Structure
Parameters:
value - The value to be added to tail of list.
See Also:
addLast(java.lang.Object)
Postcondition:
value is added to tail of list

remove

public java.lang.Object remove()
Removes value from tail of list.

Specified by:
remove in interface List
Returns:
object removed.
Precondition:
list has at least one element
Postcondition:
removes last value found in list

get

public java.lang.Object get()
Retrieves value from tail of list.

Specified by:
get in interface List
Returns:
object found at end of list
Precondition:
list has at least one element
Postcondition:
returns last value found in list

contains

public boolean contains(java.lang.Object value)
Check to see if a value is in list.

Specified by:
contains in interface List
Specified by:
contains in interface Structure
Overrides:
contains in class AbstractStructure
Parameters:
value - value sought.
Returns:
True if value is within list.
Precondition:
value is not null
Postcondition:
returns true iff list contains an object equal to value