public class ShortArrayFIFOQueue extends java.lang.Object implements ShortPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
ShortArrayFIFOQueue()
Default Construtor
|
ShortArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
ShortArrayFIFOQueue(short[] values)
Constructor using a initial array
|
ShortArrayFIFOQueue(short[] values,
int size)
Constructor using a initial array
|
ShortArrayFIFOQueue(short[] values,
int offset,
int size)
Constructor using a initial array
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
ShortComparator |
comparator() |
short |
dequeueLastShort()
A Method to remove a element from the last place instead of the first
|
short |
dequeueShort()
Method to extract a element from the PriorityQueue
|
void |
enqueueFirstShort(short e)
Method to insert a element into the first Index instead of the last.
|
void |
enqueueShort(short e)
Method to insert a element into the PriorityQueue
|
ShortIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
short |
peekShort(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeLastShort(short e)
Removes the last found element in the queue
|
boolean |
removeShort(short e)
Removes the first found element in the queue
|
int |
size() |
java.lang.Short[] |
toArray(java.lang.Short[] input)
A method to drop the contents of the Queue without clearing the queue
|
short[] |
toShortArray(short[] input)
A method to drop the contents of the Queue without clearing the queue
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeueLast, enqueueFirst, last, lastShortdequeue, enqueue, first, firstShort, peek, remove, removeLast, toArray, toShortArrayisEmptyforEach, forEach, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public ShortArrayFIFOQueue(short[] values)
values - the Array that should be usedpublic ShortArrayFIFOQueue(short[] values,
int size)
values - the Array that should be usedsize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic ShortArrayFIFOQueue(short[] values,
int offset,
int size)
values - the Array that should be usedoffset - where to begin in the initial arraysize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic ShortArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ShortArrayFIFOQueue()
public ShortIterator iterator()
ShortIterableT.iterator in interface java.lang.Iterable<java.lang.Short>iterator in interface ShortIterablepublic int size()
size in interface ObjectPriorityQueue<java.lang.Short>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Short>public void enqueueShort(short e)
ShortPriorityQueueenqueueShort in interface ShortPriorityQueuee - the element that should be insertedpublic void enqueueFirstShort(short e)
ShortPriorityDequeueenqueueFirstShort in interface ShortPriorityDequeuee - the element that should be inserted into the first placepublic short dequeueShort()
ShortPriorityQueuedequeueShort in interface ShortPriorityQueuepublic short dequeueLastShort()
ShortPriorityDequeuedequeueLastShort in interface ShortPriorityDequeuepublic short peekShort(int index)
ShortPriorityQueuepeekShort in interface ShortPriorityQueueindex - of the element that is requested to be viewed.public boolean removeShort(short e)
ShortPriorityQueueremoveShort in interface ShortPriorityQueuee - the element that should be removedpublic boolean removeLastShort(short e)
ShortPriorityQueueremoveLastShort in interface ShortPriorityQueuee - the element that should be removedpublic void onChanged()
ShortPriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Short>onChanged in interface ShortPriorityQueuepublic ShortComparator comparator()
comparator in interface ObjectPriorityQueue<java.lang.Short>comparator in interface ShortPriorityQueuepublic boolean trim(int size)
ITrimmabletrim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
clearAndTrim in interface ITrimmablesize - the amount of elements that should be allowedpublic short[] toShortArray(short[] input)
ShortPriorityQueuetoShortArray in interface ShortPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Short[] toArray(java.lang.Short[] input)
ObjectPriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Short>toArray in interface ShortPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array