public class IntArrayFIFOQueue extends java.lang.Object implements IntPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
IntArrayFIFOQueue()
Default Construtor
|
IntArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
IntArrayFIFOQueue(int[] values)
Constructor using a initial array
|
IntArrayFIFOQueue(int[] values,
int size)
Constructor using a initial array
|
IntArrayFIFOQueue(int[] 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
|
IntComparator |
comparator() |
int |
dequeueInt()
Method to extract a element from the PriorityQueue
|
int |
dequeueLastInt()
A Method to remove a element from the last place instead of the first
|
void |
enqueueFirstInt(int e)
Method to insert a element into the first Index instead of the last.
|
void |
enqueueInt(int e)
Method to insert a element into the PriorityQueue
|
IntIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
int |
peekInt(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeInt(int e)
Removes the first found element in the queue
|
boolean |
removeLastInt(int e)
Removes the last found element in the queue
|
int |
size() |
java.lang.Integer[] |
toArray(java.lang.Integer[] input)
A method to drop the contents of the Queue without clearing the queue
|
int[] |
toIntArray(int[] 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, lastIntdequeue, enqueue, first, firstInt, peek, remove, removeLast, toArray, toIntArrayisEmptyforEach, forEach, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public IntArrayFIFOQueue(int[] values)
values - the Array that should be usedpublic IntArrayFIFOQueue(int[] 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 IntArrayFIFOQueue(int[] 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 IntArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public IntArrayFIFOQueue()
public IntIterator iterator()
IntIterableT.iterator in interface java.lang.Iterable<java.lang.Integer>iterator in interface IntIterablepublic int size()
size in interface ObjectPriorityQueue<java.lang.Integer>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Integer>public void enqueueInt(int e)
IntPriorityQueueenqueueInt in interface IntPriorityQueuee - the element that should be insertedpublic void enqueueFirstInt(int e)
IntPriorityDequeueenqueueFirstInt in interface IntPriorityDequeuee - the element that should be inserted into the first placepublic int dequeueInt()
IntPriorityQueuedequeueInt in interface IntPriorityQueuepublic int dequeueLastInt()
IntPriorityDequeuedequeueLastInt in interface IntPriorityDequeuepublic int peekInt(int index)
IntPriorityQueuepeekInt in interface IntPriorityQueueindex - of the element that is requested to be viewed.public boolean removeInt(int e)
IntPriorityQueueremoveInt in interface IntPriorityQueuee - the element that should be removedpublic boolean removeLastInt(int e)
IntPriorityQueueremoveLastInt in interface IntPriorityQueuee - the element that should be removedpublic void onChanged()
IntPriorityQueueonChanged in interface IntPriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Integer>public IntComparator comparator()
comparator in interface IntPriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Integer>public 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 int[] toIntArray(int[] input)
IntPriorityQueuetoIntArray in interface IntPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Integer[] toArray(java.lang.Integer[] input)
ObjectPriorityQueuetoArray in interface IntPriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Integer>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array