public class LongArrayFIFOQueue extends java.lang.Object implements LongPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
LongArrayFIFOQueue()
Default Construtor
|
LongArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
LongArrayFIFOQueue(long[] values)
Constructor using a initial array
|
LongArrayFIFOQueue(long[] values,
int size)
Constructor using a initial array
|
LongArrayFIFOQueue(long[] 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
|
LongComparator |
comparator() |
long |
dequeueLastLong()
A Method to remove a element from the last place instead of the first
|
long |
dequeueLong()
Method to extract a element from the PriorityQueue
|
void |
enqueueFirstLong(long e)
Method to insert a element into the first Index instead of the last.
|
void |
enqueueLong(long e)
Method to insert a element into the PriorityQueue
|
LongIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
long |
peekLong(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeLastLong(long e)
Removes the last found element in the queue
|
boolean |
removeLong(long e)
Removes the first found element in the queue
|
int |
size() |
java.lang.Long[] |
toArray(java.lang.Long[] input)
A method to drop the contents of the Queue without clearing the queue
|
long[] |
toLongArray(long[] 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, lastLongdequeue, enqueue, first, firstLong, peek, remove, removeLast, toArray, toLongArrayisEmptyforEach, forEach, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public LongArrayFIFOQueue(long[] values)
values - the Array that should be usedpublic LongArrayFIFOQueue(long[] 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 LongArrayFIFOQueue(long[] 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 LongArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public LongArrayFIFOQueue()
public LongIterator iterator()
LongIterableT.iterator in interface java.lang.Iterable<java.lang.Long>iterator in interface LongIterablepublic int size()
size in interface ObjectPriorityQueue<java.lang.Long>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Long>public void enqueueLong(long e)
LongPriorityQueueenqueueLong in interface LongPriorityQueuee - the element that should be insertedpublic void enqueueFirstLong(long e)
LongPriorityDequeueenqueueFirstLong in interface LongPriorityDequeuee - the element that should be inserted into the first placepublic long dequeueLong()
LongPriorityQueuedequeueLong in interface LongPriorityQueuepublic long dequeueLastLong()
LongPriorityDequeuedequeueLastLong in interface LongPriorityDequeuepublic long peekLong(int index)
LongPriorityQueuepeekLong in interface LongPriorityQueueindex - of the element that is requested to be viewed.public boolean removeLong(long e)
LongPriorityQueueremoveLong in interface LongPriorityQueuee - the element that should be removedpublic boolean removeLastLong(long e)
LongPriorityQueueremoveLastLong in interface LongPriorityQueuee - the element that should be removedpublic void onChanged()
LongPriorityQueueonChanged in interface LongPriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Long>public LongComparator comparator()
comparator in interface LongPriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Long>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 long[] toLongArray(long[] input)
LongPriorityQueuetoLongArray in interface LongPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Long[] toArray(java.lang.Long[] input)
ObjectPriorityQueuetoArray in interface LongPriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Long>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array