All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class structure.QueueVector

java.lang.Object
   |
   +----structure.QueueVector

public class QueueVector
extends Object
implements Queue
An implementation of queues written using vectors.


Constructor Index

 o QueueVector()
Construct an empty queue.
 o QueueVector(int)
Constructs an empty queue with an initial allocation of size.

Method Index

 o add(Object)
Add a value to the tail of the queue.
 o clear()
Remove all the values from the queue.
 o dequeue()
Remove a value from the head of the queue.
 o enqueue(Object)
Add a value to the tail of the queue.
 o isEmpty()
Determine if the queue is empty.
 o peek()
Fetch the value at the head of the queue.
 o remove()
Remove a value from the head of the queue.
 o size()
Determine the number of elements within the queue.
 o toString()
Construct a string representation of the queue.

Constructors

 o QueueVector
 public QueueVector()
Construct an empty queue.

Postcondition:
constructs an empty queue.

 o QueueVector
 public QueueVector(int size)
Constructs an empty queue with an initial allocation of size.

Postcondition:
constructs an empty queue of appropriate size

Parameters:
size - Approximate largest queue size needed.

Methods

 o add
 public void add(Object value)
Add a value to the tail of the queue.

Postcondition:
the value is added to the tail of the structure

Parameters:
value - The value added.
See Also:
enqueue
 o enqueue
 public void enqueue(Object value)
Add a value to the tail of the queue.

Postcondition:
the value is added to the tail of the structure

Parameters:
value - The value to be added.
 o remove
 public Object remove()
Remove a value from the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the head of the queue is removed and returned

Returns:
The value actually removed.
See Also:
dequeue
 o dequeue
 public Object dequeue()
Remove a value from the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the head of the queue is removed and returned

Returns:
The value removed from the queue.
 o peek
 public Object peek()
Fetch the value at the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the element at the head of the queue is returned

Returns:
Reference to the first value of the queue.
 o size
 public int size()
Determine the number of elements within the queue.

Postcondition:
returns the number of elements in the queue.

Returns:
The number of elements within the queue.
 o clear
 public void clear()
Remove all the values from the queue.

Postcondition:
removes all elements from the queue.

 o isEmpty
 public boolean isEmpty()
Determine if the queue is empty.

Postcondition:
returns true iff the queue is empty

Returns:
True iff the queue is empty.
 o toString
 public String toString()
Construct a string representation of the queue.

Postcondition:
returns string representation of queue

Returns:
String representing the queue.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index