|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.util.BoundedQueue
public class BoundedQueue
This class represents an efficient queue of bounded size.
Constructor Summary | |
---|---|
BoundedQueue(java.util.Collection collection,
int capacity)
Creates a new instance of BoundedQueue copying the values in the given collection to the queue. |
|
BoundedQueue(int capacity)
Creates a new instance of BoundedQueue. |
|
BoundedQueue(java.util.Iterator it,
int capacity)
Creates a new instance of BoundedQueue copying the values from the given iterator to the queue. |
|
BoundedQueue(java.lang.Object[] array,
int capacity)
Creates a new instance of BoundedQueue copying the values in the given 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 given list to the queue. |
Method Summary | |
---|---|
void |
append(java.lang.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. |
java.lang.Object |
dequeue()
Returns the front element in this queue and removes it from the queue. |
void |
enqueue(java.lang.Object x)
Appends x to the rear of this queue. |
boolean |
isEmpty()
Returns true if this queue is empty. |
java.lang.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. |
java.lang.Object |
top()
Returns the front element in this queue. |
java.lang.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(java.lang.Object[] array, int capacity)
array
- the array to be used as the queuecapacity
- the maximum capacity of the queuepublic BoundedQueue(java.util.Collection collection, int capacity)
collection
- the elements which reside in the queue initiallycapacity
- the maximal capacity of the queuepublic BoundedQueue(java.util.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 java.lang.Object top()
!isEmpty()
public java.lang.Object dequeue()
!isEmpty()
public java.lang.Object pop()
dequeue()
!isEmpty()
public void enqueue(java.lang.Object x)
x
to the rear of this queue.
size() < capacity()
public void append(java.lang.Object x)
x
to the rear of this queue.
Same as enqueue(Object)
.
public void clear()
public int size()
public int capacity()
public boolean isEmpty()
public java.lang.String toString()
toString
in class java.lang.Object
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |