Package org.ojalgo.concurrent
Class MultiviewSet<T>
- java.lang.Object
-
- org.ojalgo.concurrent.MultiviewSet<T>
-
public final class MultiviewSet<T> extends java.lang.Object
Multiple prioritisedQueue
:s backed by a commonSet
. Typical usage:- Create a
MultiviewSet
instance - Call
newView(Comparator)
(multiple times) to create the necessary views add(Object)
, orMultiviewSet.PrioritisedView.offer(Object)
to any of the views, will have the same effect.MultiviewSet.PrioritisedView.poll()
from each of the views as needed.
- Create a
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
MultiviewSet.PrioritisedView
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<T>
myCommonSet
private java.util.Collection<MultiviewSet.PrioritisedView>
myViews
-
Constructor Summary
Constructors Constructor Description MultiviewSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T entry)
Add an entry to the commonSet
and allQueue
:s.void
clear()
boolean
isAnyContents()
boolean
isEmpty()
MultiviewSet.PrioritisedView
newView(java.util.Comparator<? super T> comparator)
boolean
remove(T entry)
Remove an entry from the commonSet
.int
size()
-
-
-
Field Detail
-
myCommonSet
private final java.util.Set<T> myCommonSet
-
myViews
private final java.util.Collection<MultiviewSet.PrioritisedView> myViews
-
-
Method Detail
-
add
public boolean add(T entry)
Add an entry to the commonSet
and allQueue
: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.PrioritisedView newView(java.util.Comparator<? super T> comparator)
-
remove
public boolean remove(T entry)
Remove an entry from the commonSet
.
-
size
public int size()
-
-