|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.AbstractStructure structure.AbstractLinear structure.AbstractQueue structure.QueueVector
public class QueueVector
An implementation of queues written using vectors.
Field Summary | |
---|---|
protected Vector |
data
The vector that maintains the queue data |
Constructor Summary | |
---|---|
QueueVector()
Construct an empty queue |
|
QueueVector(int size)
Constructs an empty queue with an initial allocation of size. |
Method Summary | |
---|---|
void |
add(java.lang.Object value)
Add a value to the tail of the queue |
void |
clear()
Remove all the values from the queue. |
java.lang.Object |
get()
Fetch the value at the head of the queue. |
boolean |
isEmpty()
Determine if the queue is empty. |
java.util.Iterator |
iterator()
Returns an iterator for traversing the structure. |
java.lang.Object |
remove()
Remove a value from the head of the queue |
int |
size()
Determine the number of elements within the queue. |
java.lang.String |
toString()
Construct a string representation of the queue. |
Methods inherited from class structure.AbstractQueue |
---|
dequeue, enqueue, getFirst, peek |
Methods inherited from class structure.AbstractLinear |
---|
empty, remove |
Methods inherited from class structure.AbstractStructure |
---|
contains, elements, hashCode, values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface structure.Queue |
---|
dequeue, empty, enqueue, getFirst, peek |
Methods inherited from interface structure.Structure |
---|
contains, elements, remove, values |
Field Detail |
---|
protected Vector data
Constructor Detail |
---|
public QueueVector()
public QueueVector(int size)
size
- Approximate largest queue size needed.Method Detail |
---|
public void add(java.lang.Object value)
add
in interface Linear
add
in interface Queue
add
in interface Structure
value
- The value added.Queue.enqueue(java.lang.Object)
public java.lang.Object remove()
remove
in interface Linear
remove
in interface Queue
AbstractQueue.dequeue()
public java.lang.Object get()
get
in interface Linear
get
in interface Queue
public int size()
size
in interface Linear
size
in interface Queue
size
in interface Structure
public void clear()
clear
in interface Structure
public boolean isEmpty()
isEmpty
in interface Structure
isEmpty
in class AbstractStructure
public java.util.Iterator iterator()
Structure
iterator
in interface Structure
AbstractIterator
,
Iterator
,
Enumeration
,
Structure.elements()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |