Modul speiger.src.collections
Klasse ObjectArrayFIFOQueue<T>
java.lang.Object
speiger.src.collections.objects.queues.AbstractObjectPriorityQueue<T>
speiger.src.collections.objects.queues.ObjectArrayFIFOQueue<T>
- Typparameter:
T- the keyType of elements maintained by this Collection
- Alle implementierten Schnittstellen:
Iterable<T>,ObjectIterable<T>,ObjectPriorityDequeue<T>,ObjectPriorityQueue<T>,ITrimmable
public class ObjectArrayFIFOQueue<T>
extends AbstractObjectPriorityQueue<T>
implements ObjectPriorityDequeue<T>, ITrimmable
A Simple First In First Out Priority Queue that is a Good Replacement for a linked list (or ArrayDequeue)
Its specific implementation uses a backing array that grows and shrinks as it is needed.
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final intThe Minimum Capacity that is allowed -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungDefault ConstrutorObjectArrayFIFOQueue(int capacity) Constructor with a Min CapacityObjectArrayFIFOQueue(T[] values) Constructor using a initial arrayObjectArrayFIFOQueue(T[] values, int size) Constructor using a initial arrayObjectArrayFIFOQueue(T[] values, int offset, int size) Constructor using a initial array -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclear()clears all elements within the PriorityQueue, this does not resize the backing arraysvoidclearAndTrim(int size) Trims the collection down to the requested size and clears all elements while doing soComparator<? super T>booleanMethod to find out if a element is part of the queuecopy()A Function that does a shallow clone of the PriorityQueue itself.intHelper function to reduce stream usage that allows to count the valid elements.dequeue()Method to extract a element from the PriorityQueueA Method to remove a element from the last place instead of the firstvoidMethod to insert a element into the PriorityQueuevoidenqueueFirst(T e) Method to insert a element into the first Index instead of the last.Helper function to reduce stream usage that allows to filter for the first match.<E> voidforEach(E input, ObjectObjectConsumer<E, T> action) Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.voidvoidforEachIndexed(IntObjectConsumer<T> action) A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.iterator()Returns an iterator over elements of typeT.booleanmatchesAll(Predicate<T> filter) Helper function to reduce stream usage that allows to filter for all matches.booleanmatchesAny(Predicate<T> filter) Helper function to reduce stream usage that allows to filter for any matches.booleanmatchesNone(Predicate<T> filter) Helper function to reduce stream usage that allows to filter for no matches.voidAllows to notify the Queue to be revalidate its datapeek(int index) Peeking function to see whats inside the queue.<E> Ereduce(E identity, BiFunction<E, T, E> operator) Performs a reduction on the elements of this Iterablereduce(ObjectObjectUnaryOperator<T, T> operator) Performs a reduction on the elements of this IterablebooleanremoveFirst(T e) Removes the first found element in the queuebooleanremoveLast(T e) Removes the last found element in the queueintsize()<E> E[]toArray(E[] input) A method to drop the contents of the Queue without clearing the queuebooleantrim(int size) Trims the original collection down to the size of the current elements or the requested size depending which is biggerVon Klasse geerbte Methoden speiger.src.collections.objects.queues.AbstractObjectPriorityQueue
equals, hashCode, toStringVon Schnittstelle geerbte Methoden speiger.src.collections.utils.ITrimmable
clearAndTrim, trimVon Schnittstelle geerbte Methoden speiger.src.collections.objects.collections.ObjectIterable
arrayflatMap, asAsync, distinct, filter, flatMap, limit, map, mapToBoolean, mapToByte, mapToDouble, mapToFloat, mapToInt, mapToLong, mapToShort, peek, pour, pourAsList, pourAsSet, repeat, sorted, spliteratorVon Schnittstelle geerbte Methoden speiger.src.collections.objects.queues.ObjectPriorityDequeue
enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, enqueueAllFirst, last, synchronizeQueue, synchronizeQueueVon Schnittstelle geerbte Methoden speiger.src.collections.objects.queues.ObjectPriorityQueue
enqueueAll, enqueueAll, enqueueAll, enqueueAll, enqueueAll, first, isEmpty, toArray, toArray
-
Felddetails
-
MIN_CAPACITY
public static final int MIN_CAPACITYThe Minimum Capacity that is allowed- Siehe auch:
-
-
Konstruktordetails
-
ObjectArrayFIFOQueue
Constructor using a initial array- Parameter:
values- the Array that should be used
-
ObjectArrayFIFOQueue
Constructor using a initial array- Parameter:
values- the Array that should be usedsize- the amount of elements that are in the initial array- Löst aus:
IllegalStateException- if values is smaller then size
-
ObjectArrayFIFOQueue
Constructor using a initial array- Parameter:
values- the Array that should be usedoffset- where to begin in the initial arraysize- the amount of elements that are in the initial array- Löst aus:
IllegalStateException- if values is smaller then size
-
ObjectArrayFIFOQueue
public ObjectArrayFIFOQueue(int capacity) Constructor with a Min Capacity- Parameter:
capacity- the initial capacity of the backing array- Löst aus:
IllegalStateException- if the initial size is smaller 0
-
ObjectArrayFIFOQueue
public ObjectArrayFIFOQueue()Default Construtor
-
-
Methodendetails
-
iterator
Beschreibung aus Schnittstelle kopiert:ObjectIterableReturns an iterator over elements of typeT.- Angegeben von:
iteratorin SchnittstelleIterable<T>- Angegeben von:
iteratorin SchnittstelleObjectIterable<T>- Angegeben von:
iteratorin SchnittstelleObjectPriorityQueue<T>- Gibt zurück:
- draining iterator of the PriorityQueue
-
size
public int size()- Angegeben von:
sizein SchnittstelleObjectPriorityQueue<T>- Gibt zurück:
- the amount of elements that are stored in the PriorityQueue
-
clear
public void clear()Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueclears all elements within the PriorityQueue, this does not resize the backing arrays- Angegeben von:
clearin SchnittstelleObjectPriorityQueue<T>
-
enqueue
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueMethod to insert a element into the PriorityQueue- Angegeben von:
enqueuein SchnittstelleObjectPriorityQueue<T>- Parameter:
e- the element that should be inserted
-
enqueueFirst
Beschreibung aus Schnittstelle kopiert:ObjectPriorityDequeueMethod to insert a element into the first Index instead of the last.- Angegeben von:
enqueueFirstin SchnittstelleObjectPriorityDequeue<T>- Parameter:
e- the element that should be inserted into the first place
-
dequeue
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueMethod to extract a element from the PriorityQueue- Angegeben von:
dequeuein SchnittstelleObjectPriorityQueue<T>- Gibt zurück:
- a element from the Queue
-
dequeueLast
Beschreibung aus Schnittstelle kopiert:ObjectPriorityDequeueA Method to remove a element from the last place instead of the first- Angegeben von:
dequeueLastin SchnittstelleObjectPriorityDequeue<T>- Gibt zurück:
- the last element inserted
-
peek
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueuePeeking function to see whats inside the queue.- Angegeben von:
peekin SchnittstelleObjectPriorityQueue<T>- Parameter:
index- of the element that is requested to be viewed.- Gibt zurück:
- the element that is requested
-
contains
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueMethod to find out if a element is part of the queue- Angegeben von:
containsin SchnittstelleObjectPriorityQueue<T>- Parameter:
e- the element that is searched for- Gibt zurück:
- true if the element is in the queue
-
removeFirst
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueRemoves the first found element in the queue- Angegeben von:
removeFirstin SchnittstelleObjectPriorityQueue<T>- Parameter:
e- the element that should be removed- Gibt zurück:
- if a searched element was removed
-
removeLast
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueRemoves the last found element in the queue- Angegeben von:
removeLastin SchnittstelleObjectPriorityQueue<T>- Parameter:
e- the element that should be removed- Gibt zurück:
- if a searched element was removed
-
onChanged
public void onChanged()Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueAllows to notify the Queue to be revalidate its data- Angegeben von:
onChangedin SchnittstelleObjectPriorityQueue<T>
-
copy
Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueA Function that does a shallow clone of the PriorityQueue itself. This function is more optimized then a copy constructor since the PriorityQueue does not have to be unsorted/resorted. It can be compared to Cloneable but with less exception risk- Angegeben von:
copyin SchnittstelleObjectPriorityDequeue<T>- Angegeben von:
copyin SchnittstelleObjectPriorityQueue<T>- Gibt zurück:
- a Shallow Copy of the PriorityQueue
-
comparator
- Angegeben von:
comparatorin SchnittstelleObjectPriorityQueue<T>- Gibt zurück:
- the sorter of the Queue, can be null
-
forEach
-
forEachIndexed
Beschreibung aus Schnittstelle kopiert:ObjectIterableA Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.- Angegeben von:
forEachIndexedin SchnittstelleObjectIterable<T>- Parameter:
action- The action to be performed for each element
-
forEach
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.- Angegeben von:
forEachin SchnittstelleObjectIterable<T>- Typparameter:
E- the generic type of the Object- Parameter:
input- the object that should be includedaction- The action to be performed for each element
-
matchesAny
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce stream usage that allows to filter for any matches.- Angegeben von:
matchesAnyin SchnittstelleObjectIterable<T>- Parameter:
filter- that should be applied- Gibt zurück:
- true if any matches were found
-
matchesNone
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce stream usage that allows to filter for no matches.- Angegeben von:
matchesNonein SchnittstelleObjectIterable<T>- Parameter:
filter- that should be applied- Gibt zurück:
- true if no matches were found
-
matchesAll
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce stream usage that allows to filter for all matches.- Angegeben von:
matchesAllin SchnittstelleObjectIterable<T>- Parameter:
filter- that should be applied- Gibt zurück:
- true if all matches.
-
findFirst
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce stream usage that allows to filter for the first match.- Angegeben von:
findFirstin SchnittstelleObjectIterable<T>- Parameter:
filter- that should be applied- Gibt zurück:
- the found value or the null equivalent variant.
-
reduce
Beschreibung aus Schnittstelle kopiert:ObjectIterablePerforms a reduction on the elements of this Iterable- Angegeben von:
reducein SchnittstelleObjectIterable<T>- Typparameter:
E- the keyType of elements maintained by this Collection- Parameter:
identity- the start valueoperator- the operation that should be applied- Gibt zurück:
- the reduction result, returns identity if nothing was found
-
reduce
Beschreibung aus Schnittstelle kopiert:ObjectIterablePerforms a reduction on the elements of this Iterable- Angegeben von:
reducein SchnittstelleObjectIterable<T>- Parameter:
operator- the operation that should be applied- Gibt zurück:
- the reduction result, returns null value if nothing was found
-
count
Beschreibung aus Schnittstelle kopiert:ObjectIterableHelper function to reduce stream usage that allows to count the valid elements.- Angegeben von:
countin SchnittstelleObjectIterable<T>- Parameter:
filter- that should be applied- Gibt zurück:
- the amount of Valid Elements
-
trim
public boolean trim(int size) Beschreibung aus Schnittstelle kopiert:ITrimmableTrims the original collection down to the size of the current elements or the requested size depending which is bigger- Angegeben von:
trimin SchnittstelleITrimmable- Parameter:
size- the requested trim size.- Gibt zurück:
- if the internal array has been trimmed.
-
clearAndTrim
public void clearAndTrim(int size) Trims the collection down to the requested size and clears all elements while doing so- Angegeben von:
clearAndTrimin SchnittstelleITrimmable- Parameter:
size- the amount of elements that should be allowed- Note:
- this will enforce minimum size of the collection itself
-
toArray
public <E> E[] toArray(E[] input) Beschreibung aus Schnittstelle kopiert:ObjectPriorityQueueA method to drop the contents of the Queue without clearing the queue- Angegeben von:
toArrayin SchnittstelleObjectPriorityQueue<T>- Typparameter:
E- the keyType of elements maintained by this Collection- Parameter:
input- where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array- Gibt zurück:
- the contents of the queue into a seperate array.
-