structure5
Class AbstractLinear<E>

java.lang.Object
  extended by structure5.AbstractStructure<E>
      extended by structure5.AbstractLinear<E>
All Implemented Interfaces:
java.lang.Iterable<E>, Linear<E>, Structure<E>
Direct Known Subclasses:
AbstractQueue, AbstractStack

public abstract class AbstractLinear<E>
extends AbstractStructure<E>
implements Linear<E>

An abstract implemtation of linear data structures. Linear structures have completely determined add and remove methods. Linear structures are often used to store the the state of a recursively solved problem and stacks and queues are classic examples of such structures.

See Also:
structure.Stack, structure.Queue

Constructor Summary
AbstractLinear()
           
 
Method Summary
 boolean empty()
          Determine if there are elements within the linear.
 E remove(E o)
          Removes value from the linear structure.
 
Methods inherited from class structure5.AbstractStructure
contains, elements, hashCode, isEmpty, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface structure5.Linear
add, get, remove, size
 
Methods inherited from interface structure5.Structure
clear, contains, elements, isEmpty, iterator, values
 

Constructor Detail

AbstractLinear

public AbstractLinear()
Method Detail

empty

public boolean empty()
Determine if there are elements within the linear.

Specified by:
empty in interface Linear<E>
Returns:
true if the linear structure is empty; false otherwise
Postcondition:
return true iff the linear structure is empty

remove

public E remove(E o)
Removes value from the linear structure. Not implemented (by default) for linear classes.

Specified by:
remove in interface Structure<E>
Parameters:
value - value matching the value to be removed
Returns:
returns the value that was replaced, or null if none.
Precondition:
value is non-null
Postcondition:
value is removed from linear structure, if it was there