structure
Interface Linear

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

public interface Linear
extends Structure

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:
Stack, Queue

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

Method Detail

add

public void add(java.lang.Object value)
Add a value to the structure. The type of structure determines the location of the value added.

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

get

public java.lang.Object get()
Preview the object to be removed.

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

remove

public java.lang.Object remove()
Remove a value from the structure. The particular value to be removed is determined by the structure.

Returns:
Value removed from structure.

size

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

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

empty

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

Returns:
True iff the linear structure is empty.