|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.util.BoundedQueue
This class represents an efficient queue of bounded size.
Constructor Summary | |
BoundedQueue(Collection collection,
int capacity)
Creates a new instance of BoundedQueue copying the values in array to the queue. |
|
BoundedQueue(int capacity)
Creates a new instance of BoundedQueue. |
|
BoundedQueue(Iterator it,
int capacity)
Creates a new instance of BoundedQueue copying the values in array to the queue. |
|
BoundedQueue(Object[] array,
int capacity)
Creates a new instance of BoundedQueue copying the values in array to the queue. |
|
BoundedQueue(YCursor cr,
int capacity)
Creates a new instance of BoundedQueue copying the values from the cursor to the queue |
|
BoundedQueue(YList list,
int capacity)
Creates a new instance of BoundedQueue copying the values in the list to the queue |
Method Summary | |
void |
append(Object x)
Appends x to the rear of this queue.
|
int |
capacity()
Returns the maximal number of elements that this queue can hold. |
void |
clear()
Removes all elements from this queue. |
Object |
dequeue()
Returns the front element in this queue and removes it from the queue. |
void |
enqueue(Object x)
Appends x to the rear of this queue. |
boolean |
isEmpty()
Returns true if this queue is empty. |
Object |
pop()
Returns the front element in this queue and removes it from the queue. |
int |
size()
Returns the number of elements in this queue. |
Object |
top()
Returns the front element in this queue. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BoundedQueue(int capacity)
capacity
- the maximum capacity of this queue.public BoundedQueue(Object[] array, int capacity)
array
- the array to be used as the queuecapacity
- the maximul capacity of the queuepublic BoundedQueue(Collection collection, int capacity)
collection
- the elements which reside in the queue initiallycapacity
- the maximal capacity of the queuepublic BoundedQueue(Iterator it, int capacity)
it
- an iterator granting access to the initial elements of the queue.capacity
- the maximal capacity of the queuepublic BoundedQueue(YList list, int capacity)
list
- the elements which reside in the queue initiallycapacity
- the maximum capacity of the queuepublic BoundedQueue(YCursor cr, int capacity)
cr
- a cursor granting access to the initial elements of the queue.capacity
- the maximal capacity of the queueMethod Detail |
public Object top()
!isEmpty()
public Object dequeue()
!isEmpty()
public Object pop()
Same as BoundedQueue.dequeue()
!isEmpty()
public void enqueue(Object x)
x
to the rear of this queue.
size() < capacity()
public void append(Object x)
x
to the rear of this queue.
Same as BoundedQueue.enqueue(Object)
.
public void clear()
public int size()
public int capacity()
public boolean isEmpty()
public String toString()
toString
in class Object
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |