public class ByteArrayFIFOQueue extends java.lang.Object implements BytePriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
ByteArrayFIFOQueue()
Default Construtor
|
ByteArrayFIFOQueue(byte[] values)
Constructor using a initial array
|
ByteArrayFIFOQueue(byte[] values,
int size)
Constructor using a initial array
|
ByteArrayFIFOQueue(byte[] values,
int offset,
int size)
Constructor using a initial array
|
ByteArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
| 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
|
ByteComparator |
comparator() |
byte |
dequeueByte()
Method to extract a element from the PriorityQueue
|
byte |
dequeueLastByte()
A Method to remove a element from the last place instead of the first
|
void |
enqueueByte(byte e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirstByte(byte e)
Method to insert a element into the first Index instead of the last.
|
ByteIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
byte |
peekByte(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeByte(byte e)
Removes the first found element in the queue
|
boolean |
removeLastByte(byte e)
Removes the last found element in the queue
|
int |
size() |
java.lang.Byte[] |
toArray(java.lang.Byte[] input)
A method to drop the contents of the Queue without clearing the queue
|
byte[] |
toByteArray(byte[] 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, lastBytedequeue, enqueue, first, firstByte, peek, remove, removeLast, toArray, toByteArrayisEmptyforEach, forEach, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public ByteArrayFIFOQueue(byte[] values)
values - the Array that should be usedpublic ByteArrayFIFOQueue(byte[] 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 ByteArrayFIFOQueue(byte[] 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 ByteArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ByteArrayFIFOQueue()
public ByteIterator iterator()
ByteIterableT.iterator in interface java.lang.Iterable<java.lang.Byte>iterator in interface ByteIterablepublic int size()
size in interface ObjectPriorityQueue<java.lang.Byte>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Byte>public void enqueueByte(byte e)
BytePriorityQueueenqueueByte in interface BytePriorityQueuee - the element that should be insertedpublic void enqueueFirstByte(byte e)
BytePriorityDequeueenqueueFirstByte in interface BytePriorityDequeuee - the element that should be inserted into the first placepublic byte dequeueByte()
BytePriorityQueuedequeueByte in interface BytePriorityQueuepublic byte dequeueLastByte()
BytePriorityDequeuedequeueLastByte in interface BytePriorityDequeuepublic byte peekByte(int index)
BytePriorityQueuepeekByte in interface BytePriorityQueueindex - of the element that is requested to be viewed.public boolean removeByte(byte e)
BytePriorityQueueremoveByte in interface BytePriorityQueuee - the element that should be removedpublic boolean removeLastByte(byte e)
BytePriorityQueueremoveLastByte in interface BytePriorityQueuee - the element that should be removedpublic void onChanged()
BytePriorityQueueonChanged in interface BytePriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Byte>public ByteComparator comparator()
comparator in interface BytePriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Byte>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 byte[] toByteArray(byte[] input)
BytePriorityQueuetoByteArray in interface BytePriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Byte[] toArray(java.lang.Byte[] input)
ObjectPriorityQueuetoArray in interface BytePriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Byte>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array