structure5
Interface Linear<E>

All Superinterfaces:
Iterable<E>, Structure<E>
All Known Subinterfaces:
Queue<E>, Stack<E>
All Known Implementing Classes:
AbstractLinear, AbstractQueue, AbstractStack, QueueArray, QueueList, QueueVector, StackArray, StackList, StackVector

public interface Linear<E>
extends Structure<E>

An interface describing the behavior of linear data structures, structures that that 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. The structure package provides several implementations of the Linear interface, each of which has its particular strengths and weaknesses.

See Also:
structure.Stack, structure.Queue

Method Summary
 void add(E value)
          Add a value to the structure.
 boolean empty()
          Returns true iff the structure is empty.
 E get()
          Preview the object to be removed.
 E remove()
          Remove a value from the structure.
 int size()
          Returns the number of elements in the linear structure.
 
Methods inherited from interface structure5.Structure
clear, contains, elements, isEmpty, iterator, remove, values
 

Method Detail

add

void add(E value)
Add a value to the structure. The type of structure determines the location of the value added.

Specified by:
add in interface Structure<E>
Parameters:
value - The value to be added to the structure.

get

E get()
Preview the object to be removed.

Returns:
A reference to the next object to be removed.

remove

E remove()
Remove a value from the structure. The particular value to be removed is determined by the structure.

Returns:
Value removed from structure.

size

int size()
Returns the number of elements in the linear structure.

Specified by:
size in interface Structure<E>
Returns:
number of elements in structure.

empty

boolean empty()
Returns true iff the structure is empty.

Returns:
True iff the linear structure is empty.