public class DoubleArrayFIFOQueue extends AbstractDoublePriorityQueue implements DoublePriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
DoubleArrayFIFOQueue()
Default Construtor
|
DoubleArrayFIFOQueue(double[] values)
Constructor using a initial array
|
DoubleArrayFIFOQueue(double[] values,
int size)
Constructor using a initial array
|
DoubleArrayFIFOQueue(double[] values,
int offset,
int size)
Constructor using a initial array
|
DoubleArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
DoubleComparator |
comparator() |
DoubleArrayFIFOQueue |
copy()
A Function that does a shallow clone of the PriorityQueue itself.
|
int |
count(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
double |
dequeue()
Method to extract a element from the PriorityQueue
|
double |
dequeueLast()
A Method to remove a element from the last place instead of the first
|
void |
enqueue(double e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirst(double e)
Method to insert a element into the first Index instead of the last.
|
double |
findFirst(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
void |
forEach(DoubleConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectDoubleConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEachIndexed(IntDoubleConsumer action)
A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
|
DoubleIterator |
iterator()
Returns an iterator over elements of type
T. |
boolean |
matchesAll(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(java.util.function.DoublePredicate filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
double |
peek(int index)
Peeking function to see whats inside the queue.
|
double |
reduce(double identity,
DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
double |
reduce(DoubleDoubleUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
removeFirst(double e)
Removes the first found element in the queue
|
boolean |
removeLast(double e)
Removes the last found element in the queue
|
int |
size() |
double[] |
toDoubleArray(double[] input)
A method to drop the contents of the Queue without clearing the queue
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
equals, hashCode, toStringenqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, last, synchronizeQueue, synchronizeQueueenqueueAll, enqueueAll, enqueueAll, enqueueAll, first, isEmpty, toDoubleArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pour, pourAsList, pourAsSet, repeat, sorted, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public DoubleArrayFIFOQueue(double[] values)
values - the Array that should be usedpublic DoubleArrayFIFOQueue(double[] values,
int size)
values - the Array that should be usedsize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic DoubleArrayFIFOQueue(double[] values,
int offset,
int size)
values - the Array that should be usedoffset - where to begin in the initial arraysize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic DoubleArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public DoubleArrayFIFOQueue()
public DoubleIterator iterator()
DoubleIterableT.iterator in interface java.lang.Iterable<java.lang.Double>iterator in interface DoubleIterablepublic int size()
size in interface DoublePriorityQueuepublic void clear()
DoublePriorityQueueclear in interface DoublePriorityQueuepublic void enqueue(double e)
DoublePriorityQueueenqueue in interface DoublePriorityQueuee - the element that should be insertedpublic void enqueueFirst(double e)
DoublePriorityDequeueenqueueFirst in interface DoublePriorityDequeuee - the element that should be inserted into the first placepublic double dequeue()
DoublePriorityQueuedequeue in interface DoublePriorityQueuepublic double dequeueLast()
DoublePriorityDequeuedequeueLast in interface DoublePriorityDequeuepublic double peek(int index)
DoublePriorityQueuepeek in interface DoublePriorityQueueindex - of the element that is requested to be viewed.public boolean removeFirst(double e)
DoublePriorityQueueremoveFirst in interface DoublePriorityQueuee - the element that should be removedpublic boolean removeLast(double e)
DoublePriorityQueueremoveLast in interface DoublePriorityQueuee - the element that should be removedpublic void onChanged()
DoublePriorityQueueonChanged in interface DoublePriorityQueuepublic DoubleArrayFIFOQueue copy()
DoublePriorityQueuecopy in interface DoublePriorityDequeuecopy in interface DoublePriorityQueuepublic DoubleComparator comparator()
comparator in interface DoublePriorityQueuepublic void forEach(DoubleConsumer action)
DoubleIterableforEach in interface DoubleIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public void forEachIndexed(IntDoubleConsumer action)
DoubleIterableforEachIndexed in interface DoubleIterableaction - The action to be performed for each elementpublic <E> void forEach(E input,
ObjectDoubleConsumer<E> action)
DoubleIterableforEach in interface DoubleIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(java.util.function.DoublePredicate filter)
DoubleIterablematchesAny in interface DoubleIterablefilter - that should be appliedpublic boolean matchesNone(java.util.function.DoublePredicate filter)
DoubleIterablematchesNone in interface DoubleIterablefilter - that should be appliedpublic boolean matchesAll(java.util.function.DoublePredicate filter)
DoubleIterablematchesAll in interface DoubleIterablefilter - that should be appliedpublic double findFirst(java.util.function.DoublePredicate filter)
DoubleIterablefindFirst in interface DoubleIterablefilter - that should be appliedpublic double reduce(double identity,
DoubleDoubleUnaryOperator operator)
DoubleIterablereduce in interface DoubleIterableidentity - the start valueoperator - the operation that should be appliedpublic double reduce(DoubleDoubleUnaryOperator operator)
DoubleIterablereduce in interface DoubleIterableoperator - the operation that should be appliedpublic int count(java.util.function.DoublePredicate filter)
DoubleIterablecount in interface DoubleIterablefilter - that should be appliedpublic boolean trim(int size)
ITrimmabletrim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
clearAndTrim in interface ITrimmablesize - the amount of elements that should be allowedpublic 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 array