Klasse ObjectPriorityQueues.SynchronizedPriorityQueue<T>

java.lang.Object
speiger.src.collections.objects.utils.ObjectPriorityQueues.SynchronizedPriorityQueue<T>
Typparameter:
T - the keyType of elements maintained by this Collection
Alle implementierten Schnittstellen:
Iterable<T>, ObjectIterable<T>, ObjectPriorityQueue<T>
Bekannte direkte Unterklassen:
ObjectPriorityQueues.SynchronizedPriorityDequeue
Umschließende Klasse:
ObjectPriorityQueues

public static class ObjectPriorityQueues.SynchronizedPriorityQueue<T> extends Object implements ObjectPriorityQueue<T>
Wrapper class for synchronization
  • Methodendetails

    • iterator

      public ObjectIterator<T> iterator()
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Returns an iterator over elements of type T.
      Angegeben von:
      iterator in Schnittstelle Iterable<T>
      Angegeben von:
      iterator in Schnittstelle ObjectIterable<T>
      Angegeben von:
      iterator in Schnittstelle ObjectPriorityQueue<T>
      Gibt zurück:
      draining iterator of the PriorityQueue
    • size

      public int size()
      Angegeben von:
      size in Schnittstelle ObjectPriorityQueue<T>
      Gibt zurück:
      the amount of elements that are stored in the PriorityQueue
    • clear

      public void clear()
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      clears all elements within the PriorityQueue, this does not resize the backing arrays
      Angegeben von:
      clear in Schnittstelle ObjectPriorityQueue<T>
    • enqueue

      public void enqueue(T e)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to insert a element into the PriorityQueue
      Angegeben von:
      enqueue in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      e - the element that should be inserted
    • enqueueAll

      public void enqueueAll(T[] e, int offset, int length)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to mass insert elements into the PriorityQueue
      Angegeben von:
      enqueueAll in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      e - the elements that should be inserted
      offset - the offset where in the array should be started
      length - the amount of elements that should be inserted
    • enqueueAll

      public void enqueueAll(ObjectCollection<T> c)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to mass insert elements into the PriorityQueue
      Angegeben von:
      enqueueAll in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      c - the elements that should be inserted from the Collection
    • enqueueAll

      public void enqueueAll(Collection<? extends T> c)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to mass insert elements into the PriorityQueue This method exists to add support for Java Collections to make it more useable
      Angegeben von:
      enqueueAll in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      c - the elements that should be inserted from the Collection
    • dequeue

      public T dequeue()
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to extract a element from the PriorityQueue
      Angegeben von:
      dequeue in Schnittstelle ObjectPriorityQueue<T>
      Gibt zurück:
      a element from the Queue
    • peek

      public T peek(int index)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Peeking function to see whats inside the queue.
      Angegeben von:
      peek in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      index - of the element that is requested to be viewed.
      Gibt zurück:
      the element that is requested
    • contains

      public boolean contains(T e)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Method to find out if a element is part of the queue
      Angegeben von:
      contains in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      e - the element that is searched for
      Gibt zurück:
      true if the element is in the queue
    • removeFirst

      public boolean removeFirst(T e)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Removes the first found element in the queue
      Angegeben von:
      removeFirst in Schnittstelle ObjectPriorityQueue<T>
      Parameter:
      e - the element that should be removed
      Gibt zurück:
      if a searched element was removed
    • removeLast

      public boolean removeLast(T e)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      Removes the last found element in the queue
      Angegeben von:
      removeLast in Schnittstelle ObjectPriorityQueue<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: ObjectPriorityQueue
      Allows to notify the Queue to be revalidate its data
      Angegeben von:
      onChanged in Schnittstelle ObjectPriorityQueue<T>
    • comparator

      public Comparator<? super T> comparator()
      Angegeben von:
      comparator in Schnittstelle ObjectPriorityQueue<T>
      Gibt zurück:
      the sorter of the Queue, can be null
    • toArray

      public <E> E[] toArray(E[] input)
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      A method to drop the contents of the Queue without clearing the queue
      Angegeben von:
      toArray in Schnittstelle ObjectPriorityQueue<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.
    • copy

      public ObjectPriorityQueue<T> copy()
      Beschreibung aus Schnittstelle kopiert: ObjectPriorityQueue
      A 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:
      copy in Schnittstelle ObjectPriorityQueue<T>
      Gibt zurück:
      a Shallow Copy of the PriorityQueue
    • forEach

      public void forEach(Consumer<? super T> action)
      Angegeben von:
      forEach in Schnittstelle Iterable<T>
    • forEach

      public <E> void forEach(E input, ObjectObjectConsumer<E,T> action)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
      Angegeben von:
      forEach in Schnittstelle ObjectIterable<T>
      Typparameter:
      E - the generic type of the Object
      Parameter:
      input - the object that should be included
      action - The action to be performed for each element
    • matchesAny

      public boolean matchesAny(Predicate<T> filter)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce stream usage that allows to filter for any matches.
      Angegeben von:
      matchesAny in Schnittstelle ObjectIterable<T>
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if any matches were found
    • matchesNone

      public boolean matchesNone(Predicate<T> filter)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce stream usage that allows to filter for no matches.
      Angegeben von:
      matchesNone in Schnittstelle ObjectIterable<T>
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if no matches were found
    • matchesAll

      public boolean matchesAll(Predicate<T> filter)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce stream usage that allows to filter for all matches.
      Angegeben von:
      matchesAll in Schnittstelle ObjectIterable<T>
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if all matches.
    • findFirst

      public T findFirst(Predicate<T> filter)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce stream usage that allows to filter for the first match.
      Angegeben von:
      findFirst in Schnittstelle ObjectIterable<T>
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the found value or the null equivalent variant.
    • count

      public int count(Predicate<T> filter)
      Beschreibung aus Schnittstelle kopiert: ObjectIterable
      Helper function to reduce stream usage that allows to count the valid elements.
      Angegeben von:
      count in Schnittstelle ObjectIterable<T>
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the amount of Valid Elements