Class MultisetBinding<E>
java.lang.Object
org.eclipse.gef.common.beans.binding.MultisetExpression<E>
org.eclipse.gef.common.beans.binding.MultisetBinding<E>
- Type Parameters:
E
- The element type of theObservableMultiset
.
- All Implemented Interfaces:
Multiset<E>
,Iterable<E>
,Collection<E>
,Binding<ObservableMultiset<E>>
,Observable
,ObservableObjectValue<ObservableMultiset<E>>
,ObservableValue<ObservableMultiset<E>>
,ObservableMultisetValue<E>
,ObservableMultiset<E>
public abstract class MultisetBinding<E>
extends MultisetExpression<E>
implements Binding<ObservableMultiset<E>>
An abstract base class that provides functionality needed to realize a
Binding
on an ObservableMultiset
.
This class provides identical functionality for Multiset
as
MapBinding
for Map
, SetBinding
for Set
, or
ListBinding
for List
.
-
Property Summary
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.collect.Multiset
Multiset.Entry<E extends Object>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(InvalidationListener listener) void
addListener
(ChangeListener<? super ObservableMultiset<E>> listener) void
addListener
(MultisetChangeListener<? super E> listener) Adds aMultisetChangeListener
to thisObservableMultiset
.protected void
bind
(Observable... dependencies) Start observing the given dependencies for changes.protected abstract ObservableMultiset<E>
Computes the current value of thisMultisetBinding
.void
dispose()
A boolean property that reflects whether theMultiset
is empty.protected void
Fires notifications to all attachedInvalidationListeners
,ChangeListeners
, andSetMultimapChangeListeners
.protected void
fireValueChangedEvent
(MultisetChangeListener.Change<? extends E> change) Fires notifications to all attachedInvalidationListeners
,ChangeListeners
, andMultisetChangeListeners
.get()
void
protected void
Can be overwritten by subclasses to receive invalidation notifications.boolean
isValid()
void
removeListener
(InvalidationListener listener) void
removeListener
(ChangeListener<? super ObservableMultiset<E>> listener) void
removeListener
(MultisetChangeListener<? super E> listener) Removes aMultisetChangeListener
from thisObservableMultiset
.An integer property that represents the size of theMultiset
.protected void
unbind
(Observable... dependencies) Stops observing the dependencies for changes.Methods inherited from class org.eclipse.gef.common.beans.binding.MultisetExpression
add, add, addAll, asString, clear, contains, containsAll, count, elementSet, entrySet, getValue, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, iterator, multisetExpression, remove, remove, removeAll, replaceAll, retainAll, setCount, setCount, size, toArray, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.google.common.collect.Multiset
equals, forEach, forEachEntry, hashCode, spliterator, toString
Methods inherited from interface javafx.beans.value.ObservableValue
getValue
-
Property Details
-
empty
- Specified by:
emptyProperty
in classMultisetExpression<E>
- Returns:
- A read-only property.
-
size
- Specified by:
sizeProperty
in classMultisetExpression<E>
- Returns:
- A read-only property.
-
-
Constructor Details
-
MultisetBinding
public MultisetBinding()
-
-
Method Details
-
addListener
- Specified by:
addListener
in interfaceObservableValue<E>
-
addListener
- Specified by:
addListener
in interfaceObservable
-
addListener
Description copied from interface:ObservableMultiset
Adds aMultisetChangeListener
to thisObservableMultiset
. If the same listener is registered more than once, it will be notified more than once.- Specified by:
addListener
in interfaceObservableMultiset<E>
- Parameters:
listener
- TheMultisetChangeListener
to add.
-
bind
Start observing the given dependencies for changes. If the value of one of the dependencies changes, the binding is marked as invalid.- Parameters:
dependencies
- The dependencies to observe.
-
computeValue
Computes the current value of thisMultisetBinding
.- Returns:
- The current value of this
MultisetBinding
.
-
dispose
public void dispose() -
emptyProperty
Description copied from class:MultisetExpression
A boolean property that reflects whether theMultiset
is empty.- Specified by:
emptyProperty
in classMultisetExpression<E>
- Returns:
- A read-only property.
-
fireValueChangedEvent
protected void fireValueChangedEvent()Fires notifications to all attachedInvalidationListeners
,ChangeListeners
, andSetMultimapChangeListeners
. -
fireValueChangedEvent
Fires notifications to all attachedInvalidationListeners
,ChangeListeners
, andMultisetChangeListeners
.- Parameters:
change
- the change that needs to be propagated
-
get
- Specified by:
get
in interfaceObservableObjectValue<E>
-
getDependencies
- Specified by:
getDependencies
in interfaceBinding<E>
-
invalidate
public void invalidate()- Specified by:
invalidate
in interfaceBinding<E>
-
invalidated
protected void invalidated()Can be overwritten by subclasses to receive invalidation notifications. Does nothing by default. -
isValid
public boolean isValid() -
removeListener
- Specified by:
removeListener
in interfaceObservableValue<E>
-
removeListener
- Specified by:
removeListener
in interfaceObservable
-
removeListener
Description copied from interface:ObservableMultiset
Removes aMultisetChangeListener
from thisObservableMultiset
. Will do nothing if the listener was not attached to thisObservableMultiset
. If it was added more than once, then only the first occurrence will be removed.- Specified by:
removeListener
in interfaceObservableMultiset<E>
- Parameters:
listener
- TheMultisetChangeListener
to remove.
-
sizeProperty
Description copied from class:MultisetExpression
An integer property that represents the size of theMultiset
.- Specified by:
sizeProperty
in classMultisetExpression<E>
- Returns:
- A read-only property.
-
unbind
Stops observing the dependencies for changes. The binding will no longer be marked as invalid if one of the dependencies changes.- Parameters:
dependencies
- The dependencies to stop observing.
-