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

Linear classes are contains that have completely determined add and remove methods. Classic examples are stacks and queues.

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

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.
Precondition:
value is non-null
Postcondition:
the value is added to the collection, the consistent replacement policy is not specified

get

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

Returns:
A reference to the next object to be removed.
Precondition:
structure is not empty
Postcondition:
returns reference to next object to be removed

remove

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.
Precondition:
structure is not empty
Postcondition:
removes an object from store

size

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

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

empty

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

Returns:
True iff the linear structure is empty.
Postcondition:
returns true if and only if the linear structure is empty