Class SetMultimapChangeListener.Change<K,V>
- Type Parameters:
K
- The key type of theObservableSetMultimap
.V
- The value type of theObservableSetMultimap
.
- Direct Known Subclasses:
SetMultimapListenerHelper.AtomicChange
- Enclosing interface:
- SetMultimapChangeListener<K,
V>
ObservableSetMultimap
,
related to a single key but to potentially multiple values.-
Constructor Summary
ConstructorsConstructorDescriptionChange
(ObservableSetMultimap<K, V> source) Creates a new (atomic) change associated with the given sourceObservableSetMultimap
. -
Method Summary
Modifier and TypeMethodDescriptionabstract K
getKey()
The key associated with the current elementary sub-change.abstract SetMultimap<K,
V> Returns an unmodifiableSetMultimap
that contains the previous contents of the sourceObservableSetMultimap
before the atomic change was applied.The sourceObservableSetMultimap
this (atomic) change is associated with.Retrieves the values that were added for the given key in the current elementary sub-change.Retrieves the values that were removed for the given key in the current elementary sub-change.abstract boolean
next()
Places the internal cursor on the next elementary sub-change, so that it be processed usinggetKey()
,getValuesAdded()
, andgetValuesRemoved()
,wasAdded()
, andwasRemoved()
.abstract void
reset()
Reset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by callingnext()
.abstract boolean
wasAdded()
Indicates whether elements were added to theObservableSetMultimap
during this elementary sub-change.abstract boolean
Indicates whether elements were removed from theObservableSetMultimap
in the current elementary sub-change.
-
Constructor Details
-
Change
Creates a new (atomic) change associated with the given sourceObservableSetMultimap
.- Parameters:
source
- The source of the change.
-
-
Method Details
-
getKey
The key associated with the current elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
next()
andreset()
.- Returns:
- The key for which values were added or removed.
-
getPreviousContents
Returns an unmodifiableSetMultimap
that contains the previous contents of the sourceObservableSetMultimap
before the atomic change was applied.This method does not depend on the state of the internal cursor, may thus be accessed independent on which elementary sub-change is currently processed.
- Returns:
- An unmodifiable
SetMultimap
representing the contents of theObservableSetMultimap
before the change.
-
getSetMultimap
The sourceObservableSetMultimap
this (atomic) change is associated with.This method does not depend on the state of the internal cursor, may thus be accessed independent on which elementary sub-change is currently processed.
- Returns:
- The source
ObservableSetMultimap
.
-
getValuesAdded
Retrieves the values that were added for the given key in the current elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
next()
andreset()
.- Returns:
- The values that have become associated with the key.
-
getValuesRemoved
Retrieves the values that were removed for the given key in the current elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
next()
andreset()
.- Returns:
- The values previously associated with the key.
-
next
public abstract boolean next()Places the internal cursor on the next elementary sub-change, so that it be processed usinggetKey()
,getValuesAdded()
, andgetValuesRemoved()
,wasAdded()
, andwasRemoved()
. This method has to be called initially to have the internal cursor point to the first elementary sub-change that is comprised.- Returns:
true
if the internal cursor could be switched to the next elementary sub-change,false
if the current elementary sub-change was the last change that is comprised.
-
reset
public abstract void reset()Reset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by callingnext()
. -
wasAdded
public abstract boolean wasAdded()Indicates whether elements were added to theObservableSetMultimap
during this elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
next()
andreset()
.- Returns:
true
if new values or (key-value) entries were added to theObservableSetMultimap
,false
otherwise.
-
wasRemoved
public abstract boolean wasRemoved()Indicates whether elements were removed from theObservableSetMultimap
in the current elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
next()
andreset()
.- Returns:
true
if old values or (key-value) entries were removed from theObservableSetMultimap
,false
otherwise.
-