public class DoubleHeapPriorityQueue extends java.lang.Object implements DoublePriorityQueue
| Constructor and Description |
|---|
DoubleHeapPriorityQueue()
Default Constructor
|
DoubleHeapPriorityQueue(double[] array)
Constructor using a initial array
|
DoubleHeapPriorityQueue(double[] array,
DoubleComparator comp)
Constructor using a initial array and a custom sorter
|
DoubleHeapPriorityQueue(double[] array,
int size)
Constructor using a initial array
|
DoubleHeapPriorityQueue(double[] array,
int size,
DoubleComparator comp)
Constructor using a initial array and a custom sorter
|
DoubleHeapPriorityQueue(DoubleCollection c)
Constructor using a Collection
|
DoubleHeapPriorityQueue(DoubleCollection c,
DoubleComparator comp)
Constructor using a Collection and a custom sorter
|
DoubleHeapPriorityQueue(DoubleComparator comp)
Constructor using custom sorter
|
DoubleHeapPriorityQueue(int size)
Constructor with a Min Capacity
|
DoubleHeapPriorityQueue(int size,
DoubleComparator 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
|
DoubleComparator |
comparator() |
double |
dequeueDouble()
Method to extract a element from the PriorityQueue
|
void |
enqueueDouble(double e)
Method to insert a element into the PriorityQueue
|
DoubleIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
double |
peekDouble(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeDouble(double e)
Removes the first found element in the queue
|
boolean |
removeLastDouble(double e)
Removes the last found element in the queue
|
int |
size() |
java.lang.Double[] |
toArray(java.lang.Double[] input)
A method to drop the contents of the Queue without clearing the queue
|
double[] |
toDoubleArray(double[] input)
A method to drop the contents of the Queue without clearing the queue
|
static DoubleHeapPriorityQueue |
wrap(double[] array)
Wrapping method to help serialization
|
static DoubleHeapPriorityQueue |
wrap(double[] array,
DoubleComparator comp)
Wrapping method to help serialization, using a custom sorter
|
static DoubleHeapPriorityQueue |
wrap(double[] array,
int size)
Wrapping method to help serialization
|
static DoubleHeapPriorityQueue |
wrap(double[] array,
int size,
DoubleComparator comp)
Wrapping method to help serialization, using a custom sorter
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeue, enqueue, first, firstDouble, peek, remove, removeLast, toArray, toDoubleArrayisEmptyforEach, forEach, spliteratorpublic DoubleHeapPriorityQueue()
public DoubleHeapPriorityQueue(DoubleComparator comp)
comp - Comparator to sort the Array. Can be nullpublic DoubleHeapPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public DoubleHeapPriorityQueue(int size,
DoubleComparator 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 DoubleHeapPriorityQueue(double[] array)
array - the Array that should be usedpublic DoubleHeapPriorityQueue(double[] 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 DoubleHeapPriorityQueue(double[] array,
DoubleComparator comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic DoubleHeapPriorityQueue(double[] array,
int size,
DoubleComparator 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 DoubleHeapPriorityQueue(DoubleCollection c)
c - the Collection that should be usedpublic DoubleHeapPriorityQueue(DoubleCollection c, DoubleComparator comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static DoubleHeapPriorityQueue wrap(double[] array)
array - the array that should be usedpublic static DoubleHeapPriorityQueue wrap(double[] array, int size)
array - the array that should be usedsize - the amount of elements within the arraypublic static DoubleHeapPriorityQueue wrap(double[] array, DoubleComparator comp)
array - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static DoubleHeapPriorityQueue wrap(double[] array, int size, DoubleComparator 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.Double>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Double>public DoubleIterator iterator()
DoubleIterableT.iterator in interface java.lang.Iterable<java.lang.Double>iterator in interface DoubleIterablepublic void enqueueDouble(double e)
DoublePriorityQueueenqueueDouble in interface DoublePriorityQueuee - the element that should be insertedpublic double dequeueDouble()
DoublePriorityQueuedequeueDouble in interface DoublePriorityQueuepublic double peekDouble(int index)
DoublePriorityQueuepeekDouble in interface DoublePriorityQueueindex - of the element that is requested to be viewed.public boolean removeDouble(double e)
DoublePriorityQueueremoveDouble in interface DoublePriorityQueuee - the element that should be removedpublic boolean removeLastDouble(double e)
DoublePriorityQueueremoveLastDouble in interface DoublePriorityQueuee - the element that should be removedpublic void onChanged()
DoublePriorityQueueonChanged in interface DoublePriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Double>public DoubleComparator comparator()
comparator in interface DoublePriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Double>public double[] toDoubleArray(double[] input)
DoublePriorityQueuetoDoubleArray in interface DoublePriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Double[] toArray(java.lang.Double[] input)
ObjectPriorityQueuetoArray in interface DoublePriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Double>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array