public class ByteHeapPriorityQueue extends java.lang.Object implements BytePriorityQueue
| Constructor and Description |
|---|
ByteHeapPriorityQueue()
Default Constructor
|
ByteHeapPriorityQueue(byte[] array)
Constructor using a initial array
|
ByteHeapPriorityQueue(byte[] array,
ByteComparator comp)
Constructor using a initial array and a custom sorter
|
ByteHeapPriorityQueue(byte[] array,
int size)
Constructor using a initial array
|
ByteHeapPriorityQueue(byte[] array,
int size,
ByteComparator comp)
Constructor using a initial array and a custom sorter
|
ByteHeapPriorityQueue(ByteCollection c)
Constructor using a Collection
|
ByteHeapPriorityQueue(ByteCollection c,
ByteComparator comp)
Constructor using a Collection and a custom sorter
|
ByteHeapPriorityQueue(ByteComparator comp)
Constructor using custom sorter
|
ByteHeapPriorityQueue(int size)
Constructor with a Min Capacity
|
ByteHeapPriorityQueue(int size,
ByteComparator comp)
Constructor with a Min Capacity and custom Sorter
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
ByteComparator |
comparator() |
byte |
dequeueByte()
Method to extract a element from the PriorityQueue
|
void |
enqueueByte(byte e)
Method to insert a element into the PriorityQueue
|
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
|
static ByteHeapPriorityQueue |
wrap(byte[] array)
Wrapping method to help serialization
|
static ByteHeapPriorityQueue |
wrap(byte[] array,
ByteComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static ByteHeapPriorityQueue |
wrap(byte[] array,
int size)
Wrapping method to help serialization
|
static ByteHeapPriorityQueue |
wrap(byte[] array,
int size,
ByteComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeue, enqueue, first, firstByte, peek, remove, removeLast, toArray, toByteArrayisEmptyforEach, forEach, spliteratorpublic ByteHeapPriorityQueue()
public ByteHeapPriorityQueue(ByteComparator comp)
comp - Comparator to sort the Array. Can be nullpublic ByteHeapPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ByteHeapPriorityQueue(int size,
ByteComparator comp)
size - the initial capacity of the backing arraycomp - Comparator to sort the Array. Can be nulljava.lang.IllegalStateException - if the initial size is smaller 0public ByteHeapPriorityQueue(byte[] array)
array - the Array that should be usedpublic ByteHeapPriorityQueue(byte[] array,
int size)
array - the Array that should be usedsize - the amount of elements found within the arrayjava.lang.NegativeArraySizeException - if size is smaller then 0public ByteHeapPriorityQueue(byte[] array,
ByteComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic ByteHeapPriorityQueue(byte[] array,
int size,
ByteComparator comp)
array - the Array that should be usedsize - the amount of elements found within the arraycomp - Comparator to sort the Array. Can be nulljava.lang.NegativeArraySizeException - if size is smaller then 0public ByteHeapPriorityQueue(ByteCollection c)
c - the Collection that should be usedpublic ByteHeapPriorityQueue(ByteCollection c, ByteComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ByteHeapPriorityQueue wrap(byte[] array)
array - the array that should be usedpublic static ByteHeapPriorityQueue wrap(byte[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static ByteHeapPriorityQueue wrap(byte[] array, ByteComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ByteHeapPriorityQueue wrap(byte[] array, int size, ByteComparator comp)
array - the array that should be usedsize - the amount of elements within the arraycomp - Comparator to sort the Array. Can be nullpublic int size()
size in interface ObjectPriorityQueue<java.lang.Byte>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Byte>public ByteIterator iterator()
ByteIterableT.iterator in interface java.lang.Iterable<java.lang.Byte>iterator in interface ByteIterablepublic void enqueueByte(byte e)
BytePriorityQueueenqueueByte in interface BytePriorityQueuee - the element that should be insertedpublic byte dequeueByte()
BytePriorityQueuedequeueByte in interface BytePriorityQueuepublic 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 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