T - the type of elements maintained by this Collectionpublic class ObjectHeapPriorityQueue<T> extends java.lang.Object implements ObjectPriorityQueue<T>
| Constructor and Description |
|---|
ObjectHeapPriorityQueue()
Default Constructor
|
ObjectHeapPriorityQueue(java.util.Comparator<? super T> comp)
Constructor using custom sorter
|
ObjectHeapPriorityQueue(int size)
Constructor with a Min Capacity
|
ObjectHeapPriorityQueue(int size,
java.util.Comparator<? super T> comp)
Constructor with a Min Capacity and custom Sorter
|
ObjectHeapPriorityQueue(ObjectCollection<T> c)
Constructor using a Collection
|
ObjectHeapPriorityQueue(ObjectCollection<T> c,
java.util.Comparator<? super T> comp)
Constructor using a Collection and a custom sorter
|
ObjectHeapPriorityQueue(T[] array)
Constructor using a initial array
|
ObjectHeapPriorityQueue(T[] array,
java.util.Comparator<? super T> comp)
Constructor using a initial array and a custom sorter
|
ObjectHeapPriorityQueue(T[] array,
int size)
Constructor using a initial array
|
ObjectHeapPriorityQueue(T[] array,
int size,
java.util.Comparator<? super T> comp)
Constructor using a initial array and a custom sorter
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
java.util.Comparator<? super T> |
comparator() |
T |
dequeue()
Method to extract a element from the PriorityQueue
|
void |
enqueue(T e)
Method to insert a element into the PriorityQueue
|
ObjectIterator<T> |
iterator() |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
T |
peek(int index)
Peeking function to see whats inside the queue.
|
boolean |
remove(T e)
Removes the first found element in the queue
|
boolean |
removeLast(T e)
Removes the last found element in the queue
|
int |
size() |
T[] |
toArray(T[] input)
A method to drop the contents of the Queue without clearing the queue
|
static <T> ObjectHeapPriorityQueue<T> |
wrap(T[] array)
Wrapping method to help serialization
|
static <T> ObjectHeapPriorityQueue<T> |
wrap(T[] array,
java.util.Comparator<? super T> comp)
Wrapping method to help serialization, using a custom sorter
|
static <T> ObjectHeapPriorityQueue<T> |
wrap(T[] array,
int size)
Wrapping method to help serialization
|
static <T> ObjectHeapPriorityQueue<T> |
wrap(T[] array,
int size,
java.util.Comparator<? super T> comp)
Wrapping method to help serialization, using a custom sorter
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfirst, isEmpty, toArraypublic ObjectHeapPriorityQueue()
public ObjectHeapPriorityQueue(java.util.Comparator<? super T> comp)
comp - Comparator to sort the Array. Can be nullpublic ObjectHeapPriorityQueue(int size)
size - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public ObjectHeapPriorityQueue(int size,
java.util.Comparator<? super T> 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 ObjectHeapPriorityQueue(T[] array)
array - the Array that should be usedpublic ObjectHeapPriorityQueue(T[] 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 ObjectHeapPriorityQueue(T[] array, java.util.Comparator<? super T> comp)
array - the Array that should be usedcomp - Comparator to sort the Array. Can be nullpublic ObjectHeapPriorityQueue(T[] array, int size, java.util.Comparator<? super T> 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 ObjectHeapPriorityQueue(ObjectCollection<T> c)
c - the Collection that should be usedpublic ObjectHeapPriorityQueue(ObjectCollection<T> c, java.util.Comparator<? super T> comp)
c - the Collection that should be usedcomp - Comparator to sort the Array. Can be nullpublic static <T> ObjectHeapPriorityQueue<T> wrap(T[] array)
T - the type of elements maintained by this Collectionarray - the array that should be usedpublic static <T> ObjectHeapPriorityQueue<T> wrap(T[] array, int size)
T - the type of elements maintained by this Collectionarray - the array that should be usedsize - the amount of elements within the arraypublic static <T> ObjectHeapPriorityQueue<T> wrap(T[] array, java.util.Comparator<? super T> comp)
T - the type of elements maintained by this Collectionarray - the array that should be usedcomp - Comparator to sort the Array. Can be nullpublic static <T> ObjectHeapPriorityQueue<T> wrap(T[] array, int size, java.util.Comparator<? super T> comp)
T - the type of elements maintained by this Collectionarray - 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<T>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<T>public ObjectIterator<T> iterator()
iterator in interface java.lang.Iterable<T>public void enqueue(T e)
ObjectPriorityQueueenqueue in interface ObjectPriorityQueue<T>e - the element that should be insertedpublic T dequeue()
ObjectPriorityQueuedequeue in interface ObjectPriorityQueue<T>public T peek(int index)
ObjectPriorityQueuepeek in interface ObjectPriorityQueue<T>index - of the element that is requested to be viewed.public boolean remove(T e)
ObjectPriorityQueueremove in interface ObjectPriorityQueue<T>e - the element that should be removedpublic boolean removeLast(T e)
ObjectPriorityQueueremoveLast in interface ObjectPriorityQueue<T>e - the element that should be removedpublic void onChanged()
ObjectPriorityQueueonChanged in interface ObjectPriorityQueue<T>public java.util.Comparator<? super T> comparator()
comparator in interface ObjectPriorityQueue<T>public T[] toArray(T[] input)
ObjectPriorityQueuetoArray in interface ObjectPriorityQueue<T>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array