public class CharHeapPriorityQueue extends java.lang.Object implements CharPriorityQueue
| Constructor and Description |
|---|
CharHeapPriorityQueue()
Default Constructor
|
CharHeapPriorityQueue(char[] array)
Constructor using a initial array
|
CharHeapPriorityQueue(char[] array,
CharComparator comp)
Constructor using a initial array and a custom sorter
|
CharHeapPriorityQueue(char[] array,
int size)
Constructor using a initial array
|
CharHeapPriorityQueue(char[] array,
int size,
CharComparator comp)
Constructor using a initial array and a custom sorter
|
CharHeapPriorityQueue(CharCollection c)
Constructor using a Collection
|
CharHeapPriorityQueue(CharCollection c,
CharComparator comp)
Constructor using a Collection and a custom sorter
|
CharHeapPriorityQueue(CharComparator comp)
Constructor using custom sorter
|
CharHeapPriorityQueue(int size)
Constructor with a Min Capacity
|
CharHeapPriorityQueue(int size,
CharComparator 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
|
CharComparator |
comparator() |
char |
dequeueChar()
Method to extract a element from the PriorityQueue
|
void |
enqueueChar(char e)
Method to insert a element into the PriorityQueue
|
CharIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
char |
peekChar(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeChar(char e)
Removes the first found element in the queue
|
boolean |
removeLastChar(char e)
Removes the last found element in the queue
|
int |
size() |
java.lang.Character[] |
toArray(java.lang.Character[] input)
A method to drop the contents of the Queue without clearing the queue
|
char[] |
toCharArray(char[] input)
A method to drop the contents of the Queue without clearing the queue
|
static CharHeapPriorityQueue |
wrap(char[] array)
Wrapping method to help serialization
|
static CharHeapPriorityQueue |
wrap(char[] array,
CharComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static CharHeapPriorityQueue |
wrap(char[] array,
int size)
Wrapping method to help serialization
|
static CharHeapPriorityQueue |
wrap(char[] array,
int size,
CharComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeue, enqueue, first, firstChar, peek, remove, removeLast, toArray, toCharArrayisEmptyforEach, forEach, spliteratorpublic CharHeapPriorityQueue()
public CharHeapPriorityQueue(CharComparator comp)
comp - Comparator to sort the Array. Can be nullpublic CharHeapPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public CharHeapPriorityQueue(int size,
CharComparator 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 CharHeapPriorityQueue(char[] array)
array - the Array that should be usedpublic CharHeapPriorityQueue(char[] 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 CharHeapPriorityQueue(char[] array,
CharComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic CharHeapPriorityQueue(char[] array,
int size,
CharComparator 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 CharHeapPriorityQueue(CharCollection c)
c - the Collection that should be usedpublic CharHeapPriorityQueue(CharCollection c, CharComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static CharHeapPriorityQueue wrap(char[] array)
array - the array that should be usedpublic static CharHeapPriorityQueue wrap(char[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static CharHeapPriorityQueue wrap(char[] array, CharComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static CharHeapPriorityQueue wrap(char[] array, int size, CharComparator 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.Character>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Character>public CharIterator iterator()
CharIterableT.iterator in interface java.lang.Iterable<java.lang.Character>iterator in interface CharIterablepublic void enqueueChar(char e)
CharPriorityQueueenqueueChar in interface CharPriorityQueuee - the element that should be insertedpublic char dequeueChar()
CharPriorityQueuedequeueChar in interface CharPriorityQueuepublic char peekChar(int index)
CharPriorityQueuepeekChar in interface CharPriorityQueueindex - of the element that is requested to be viewed.public boolean removeChar(char e)
CharPriorityQueueremoveChar in interface CharPriorityQueuee - the element that should be removedpublic boolean removeLastChar(char e)
CharPriorityQueueremoveLastChar in interface CharPriorityQueuee - the element that should be removedpublic void onChanged()
CharPriorityQueueonChanged in interface CharPriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Character>public CharComparator comparator()
comparator in interface CharPriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Character>public char[] toCharArray(char[] input)
CharPriorityQueuetoCharArray in interface CharPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Character[] toArray(java.lang.Character[] input)
ObjectPriorityQueuetoArray in interface CharPriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Character>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array