public class ShortArrayPriorityQueue extends java.lang.Object implements ShortPriorityQueue
List.indexOf(Object) search.
It is highly suggested to use HeapPriorityQueue otherwise, unless you know why you need this specific implementation| Constructor and Description |
|---|
ShortArrayPriorityQueue()
Default Constructor
|
ShortArrayPriorityQueue(int size)
Constructor with a Min Capacity
|
ShortArrayPriorityQueue(int size,
ShortComparator comp)
Constructor with a Min Capacity and custom Sorter
|
ShortArrayPriorityQueue(short[] array)
Constructor using a initial array
|
ShortArrayPriorityQueue(short[] array,
int size)
Constructor using a initial array
|
ShortArrayPriorityQueue(short[] array,
int size,
ShortComparator comp)
Constructor using a initial array and a custom sorter
|
ShortArrayPriorityQueue(short[] array,
ShortComparator comp)
Constructor using a initial array and a custom sorter
|
ShortArrayPriorityQueue(ShortCollection c)
Constructor using a Collection
|
ShortArrayPriorityQueue(ShortCollection c,
ShortComparator comp)
Constructor using a Collection and a custom sorter
|
ShortArrayPriorityQueue(ShortComparator comp)
Constructor using custom sorter
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
ShortComparator |
comparator() |
short |
dequeueShort()
Method to extract a element from the PriorityQueue
|
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
|
static ShortArrayPriorityQueue |
wrap(short[] array)
Wrapping method to help serialization
|
static ShortArrayPriorityQueue |
wrap(short[] array,
int size)
Wrapping method to help serialization
|
static ShortArrayPriorityQueue |
wrap(short[] array,
int size,
ShortComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static ShortArrayPriorityQueue |
wrap(short[] array,
ShortComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeue, enqueue, first, firstShort, peek, remove, removeLast, toArray, toShortArrayisEmptyforEach, forEach, spliteratorpublic ShortArrayPriorityQueue()
public ShortArrayPriorityQueue(ShortComparator comp)
comp - Comparator to sort the Array. Can be nullpublic ShortArrayPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ShortArrayPriorityQueue(int size,
ShortComparator 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 ShortArrayPriorityQueue(short[] array)
array - the Array that should be usedpublic ShortArrayPriorityQueue(short[] 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 ShortArrayPriorityQueue(short[] array,
ShortComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic ShortArrayPriorityQueue(short[] array,
int size,
ShortComparator 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 ShortArrayPriorityQueue(ShortCollection c)
c - the Collection that should be usedpublic ShortArrayPriorityQueue(ShortCollection c, ShortComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ShortArrayPriorityQueue wrap(short[] array)
array - the array that should be usedpublic static ShortArrayPriorityQueue wrap(short[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static ShortArrayPriorityQueue wrap(short[] array, ShortComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static ShortArrayPriorityQueue wrap(short[] array, int size, ShortComparator comp)
array - the array that should be usedsize - the amount of elements within the arraycomp - Comparator to sort the Array. Can be nullpublic void enqueueShort(short e)
ShortPriorityQueueenqueueShort in interface ShortPriorityQueuee - the element that should be insertedpublic short dequeueShort()
ShortPriorityQueuedequeueShort in interface ShortPriorityQueuepublic 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 int size()
size in interface ObjectPriorityQueue<java.lang.Short>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Short>public ShortIterator iterator()
ShortIterableT.iterator in interface java.lang.Iterable<java.lang.Short>iterator in interface ShortIterablepublic ShortComparator comparator()
comparator in interface ObjectPriorityQueue<java.lang.Short>comparator in interface ShortPriorityQueuepublic 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