Class MultiviewSet<T>

java.lang.Object
org.ojalgo.concurrent.MultiviewSet<T>

public final class MultiviewSet<T> extends Object
Multiple prioritised Queue:s backed by a common Set. Typical usage:
  1. Create a MultiviewSet instance
  2. Call newView(Comparator) (multiple times) to create the necessary views
  3. add(Object), or MultiviewSet.PrioritisedView.offer(Object) to any of the views, will have the same effect.
  4. MultiviewSet.PrioritisedView.poll() from each of the views as needed.
Polling skips stale entries that no longer exist in the backing set.
  • Field Details

  • Constructor Details

    • MultiviewSet

      public MultiviewSet()
  • Method Details

    • add

      public boolean add(T entry)
      Add an entry to the common Set and all Queue:s.
    • clear

      public void clear()
    • isAnyContents

      public boolean isAnyContents()
      Returns:
      true if the main set or any of the priority queues have any contents
    • isEmpty

      public boolean isEmpty()
    • newView

      public MultiviewSet<T>.PrioritisedView newView(Comparator<? super T> comparator)
    • remove

      public boolean remove(T entry)
      Remove an entry from the common Set. Entries already present in view queues are considered stale and will be skipped during MultiviewSet.PrioritisedView.poll().
    • size

      public int size()