|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wisc.cs.util.Queue
This class implements a simple FIFO queue using an array. The array is resized as necessary to permit as long a sequence of enqueue operations as possible, given memory and system restrictions on the size of an array. This implementation was chosen for it's access speed due to reduced memory usage and heap fragmentation.
Constructor Summary | |
Queue()
Constructs a new Queue object with an initial capacity of 10 and an increment of 10. |
|
Queue(int size,
int incr)
Constructs a new Queue object with the specified initial capacity and increment. |
Method Summary | |
java.lang.Object |
dequeue()
Removes and returns the next object from the queue. |
void |
enqueue(java.lang.Object o)
Adds an object to the queue. |
void |
ensureCapacity(int minCapacity)
Ensures that the queue can hold at least minCapacity elements. |
int |
size()
Returns the number of items currently in the queue. |
java.lang.String |
toString()
Returns a string representation of this Vector, containing the String representation of each element. |
void |
trimToSize()
Sets the capacity to be the current number of items in the queue. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Queue()
public Queue(int size, int incr)
size
- the initial size.incr
- the initial capacity increment.Method Detail |
public int size()
public void enqueue(java.lang.Object o)
o
- an object to add to the queue.public java.lang.Object dequeue()
public void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacity.public void trimToSize()
public java.lang.String toString()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |