Package org.ojalgo.concurrent
Class MultiviewSet<T>
java.lang.Object
org.ojalgo.concurrent.MultiviewSet<T>
Multiple prioritised
Queue
:s backed by a common Set
. 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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private final Collection
<MultiviewSet<T>.PrioritisedView> -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
myCommonSet
-
myViews
-
myRemoveFromViews
private final boolean myRemoveFromViews
-
-
Constructor Details
-
MultiviewSet
public MultiviewSet() -
MultiviewSet
public MultiviewSet(boolean removeFromViews) - Parameters:
removeFromViews
- Switch if each and every call toremove(Object)
should also explicitly callMultiviewSet.PrioritisedView.remove(Object)
on each of the views. This is (probably) innefficient, and is unnecessary as a call toMultiviewSet.PrioritisedView.poll()
will assert that the returned instance did exist in the mainSet
.
-
-
Method Details
-
add
-
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
-
remove
-
size
public int size()
-