Klasse DoublePriorityQueues.SynchronizedPriorityQueue

java.lang.Object
speiger.src.collections.doubles.utils.DoublePriorityQueues.SynchronizedPriorityQueue
Alle implementierten Schnittstellen:
Iterable<Double>, DoubleIterable, DoublePriorityQueue
Bekannte direkte Unterklassen:
DoublePriorityQueues.SynchronizedPriorityDequeue
Umschließende Klasse:
DoublePriorityQueues

public static class DoublePriorityQueues.SynchronizedPriorityQueue extends Object implements DoublePriorityQueue
Wrapper class for synchronization
  • Methodendetails

    • iterator

      public DoubleIterator iterator()
      Beschreibung aus Schnittstelle kopiert: DoubleIterable
      Returns an iterator over elements of type T.
      Angegeben von:
      iterator in Schnittstelle DoubleIterable
      Angegeben von:
      iterator in Schnittstelle Iterable<Double>
      Gibt zurück:
      an Iterator.
    • size

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

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

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

      public void enqueueAll(double[] e, int offset, int length)
      Beschreibung aus Schnittstelle kopiert: DoublePriorityQueue
      Method to mass insert elements into the PriorityQueue
      Angegeben von:
      enqueueAll in Schnittstelle DoublePriorityQueue
      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(DoubleCollection c)
      Beschreibung aus Schnittstelle kopiert: DoublePriorityQueue
      Method to mass insert elements into the PriorityQueue
      Angegeben von:
      enqueueAll in Schnittstelle DoublePriorityQueue
      Parameter:
      c - the elements that should be inserted from the Collection
    • dequeue

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

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

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

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

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

      public DoubleComparator comparator()
      Angegeben von:
      comparator in Schnittstelle DoublePriorityQueue
      Gibt zurück:
      the sorter of the Queue, can be null
    • toDoubleArray

      public double[] toDoubleArray(double[] input)
      Beschreibung aus Schnittstelle kopiert: DoublePriorityQueue
      A method to drop the contents of the Queue without clearing the queue
      Angegeben von:
      toDoubleArray in Schnittstelle DoublePriorityQueue
      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 DoublePriorityQueue copy()
      Beschreibung aus Schnittstelle kopiert: DoublePriorityQueue
      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 DoublePriorityQueue
      Gibt zurück:
      a Shallow Copy of the PriorityQueue
    • forEach

      public void forEach(DoubleConsumer action)
      Beschreibung aus Schnittstelle kopiert: DoubleIterable
      A Type Specific foreach function that reduces (un)boxing
      Angegeben von:
      forEach in Schnittstelle DoubleIterable
      Parameter:
      action - The action to be performed for each element
      Siehe auch:
    • forEach

      public <E> void forEach(E input, ObjectDoubleConsumer<E> action)
      Beschreibung aus Schnittstelle kopiert: DoubleIterable
      Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
      Angegeben von:
      forEach in Schnittstelle DoubleIterable
      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(DoublePredicate filter)
      Beschreibung aus Schnittstelle kopiert: DoubleIterable
      Helper function to reduce stream usage that allows to filter for any matches.
      Angegeben von:
      matchesAny in Schnittstelle DoubleIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if any matches were found
    • matchesNone

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

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

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

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