public class PuQueue
extends java.lang.Object
Constructor and Description |
---|
PuQueue()
Construct an empty queue.
|
PuQueue(int size)
Construct a queue with array of size
size . |
PuQueue(int[] entries)
Construct a queue the entries of a given array.
|
Modifier and Type | Method and Description |
---|---|
void |
copy(PuQueue queue)
Copy all properties of the argument to
this . |
static PuQueue |
copyNew(PuQueue queue)
Create and return copy of
this . |
void |
enqueue(int value)
Insert an element into the queue.
|
int |
extractFirst()
Get the oldest element of the queue, i.e.the element which was inserted first.
|
int |
extractLast()
Get the youngest element of the queue, i.e.the element which was inserted last.
|
int |
getNumEntries()
Get number of elements in the queue.
|
int |
getSize()
Get maximum number of entries of the queue.
|
boolean |
isEmpty()
Whether the queue has no entries.
|
void |
removeAll()
Remove all elements from queue.
|
void |
setSize(int size)
Set the size of the queue.
|
PiVector |
toPiVector()
Create a PiVector with the entries of the queue.
|
java.lang.String |
toString()
Get a string containing all elements of the queue.
|
public PuQueue()
public PuQueue(int size)
size
.
Initial number of entries is 0.size
- Size of the queue.public PuQueue(int[] entries)
entries
- Initial entries of the queue.public void copy(PuQueue queue)
this
.queue
- The queue to copy.public static PuQueue copyNew(PuQueue queue)
this
.queue
- The queue to copy.public int getNumEntries()
public int getSize()
public void enqueue(int value)
value
- Item to enqueue.public void setSize(int size)
size
- New size of the queue.public int extractFirst()
public int extractLast()
public java.lang.String toString()
toString
in class java.lang.Object
public PiVector toPiVector()
public void removeAll()
public boolean isEmpty()
"