K
- The key type of the source ObservableSetMultimap
.V
- The value type of the source ObservableSetMultimap
.public static class SetMultimapListenerHelper.AtomicChange<K,V> extends SetMultimapChangeListener.Change<K,V>
SetMultimapChangeListener.Change
.Constructor and Description |
---|
AtomicChange(ObservableSetMultimap<K,V> source,
com.google.common.collect.SetMultimap<K,V> previousContents,
java.util.List<SetMultimapListenerHelper.ElementarySubChange<K,V>> elementarySubChanges)
Creates a new
MultisetListenerHelper.AtomicChange that
represents a change comprising multiple elementary sub-changesO. |
AtomicChange(ObservableSetMultimap<K,V> source,
com.google.common.collect.SetMultimap<K,V> previousContents,
SetMultimapListenerHelper.ElementarySubChange<K,V> elementarySubChange)
Creates a new
SetMultimapListenerHelper.AtomicChange that
represents a change comprising a single elementary sub-change. |
AtomicChange(ObservableSetMultimap<K,V> source,
SetMultimapChangeListener.Change<? extends K,? extends V> change)
Creates a new
MultisetListenerHelper.AtomicChange for the
passed in source, based on the data provided in the passed-in change. |
Modifier and Type | Method and Description |
---|---|
K |
getKey()
The key associated with the current elementary sub-change.
|
com.google.common.collect.SetMultimap<K,V> |
getPreviousContents()
Returns an unmodifiable
SetMultimap that contains the
previous contents of the source ObservableSetMultimap before
the atomic change was applied. |
java.util.Set<V> |
getValuesAdded()
Retrieves the values that were added for the given key in the current
elementary sub-change.
|
java.util.Set<V> |
getValuesRemoved()
Retrieves the values that were removed for the given key in the
current elementary sub-change.
|
boolean |
next()
Places the internal cursor on the next elementary sub-change, so that
it be processed using
SetMultimapChangeListener.Change.getKey() , SetMultimapChangeListener.Change.getValuesAdded() ,
and SetMultimapChangeListener.Change.getValuesRemoved() , SetMultimapChangeListener.Change.wasAdded() , and
SetMultimapChangeListener.Change.wasRemoved() . |
void |
reset()
Reset the internal cursor to the initial state, so that the first
elementary sub-change can be accessed by calling
SetMultimapChangeListener.Change.next() . |
java.lang.String |
toString() |
boolean |
wasAdded()
Indicates whether elements were added to the
ObservableSetMultimap during this elementary sub-change. |
boolean |
wasRemoved()
Indicates whether elements were removed from the
ObservableSetMultimap in the current elementary sub-change. |
getSetMultimap
public AtomicChange(ObservableSetMultimap<K,V> source, com.google.common.collect.SetMultimap<K,V> previousContents, SetMultimapListenerHelper.ElementarySubChange<K,V> elementarySubChange)
SetMultimapListenerHelper.AtomicChange
that
represents a change comprising a single elementary sub-change.source
- The source ObservableSetMultimap
from which the
change originated.previousContents
- The previous contents of the ObservableSetMultimap
before the change was applied.elementarySubChange
- The elementary sub-change that has been applied.public AtomicChange(ObservableSetMultimap<K,V> source, com.google.common.collect.SetMultimap<K,V> previousContents, java.util.List<SetMultimapListenerHelper.ElementarySubChange<K,V>> elementarySubChanges)
MultisetListenerHelper.AtomicChange
that
represents a change comprising multiple elementary sub-changesO.source
- The source ObservableMultiset
from which the
change originated.previousContents
- The previous contents of the ObservableMultiset
before the change was applied.elementarySubChanges
- The elementary sub-changes that have been applied as part
of this change.public AtomicChange(ObservableSetMultimap<K,V> source, SetMultimapChangeListener.Change<? extends K,? extends V> change)
MultisetListenerHelper.AtomicChange
for the
passed in source, based on the data provided in the passed-in change.
This is basically used to allow properties wrapping an
ObservableMultiset
to re-fire change events of their wrapped
ObservableMultiset
with themselves as source.
source
- The new source ObservableMultiset
.change
- The change to infer a new change from. It is expected that
the change is in initial state. In either case it will be
reset to initial state.public K getKey()
SetMultimapChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via SetMultimapChangeListener.Change.next()
and SetMultimapChangeListener.Change.reset()
.
getKey
in class SetMultimapChangeListener.Change<K,V>
public com.google.common.collect.SetMultimap<K,V> getPreviousContents()
SetMultimapChangeListener.Change
SetMultimap
that contains the
previous contents of the source ObservableSetMultimap
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.
getPreviousContents
in class SetMultimapChangeListener.Change<K,V>
SetMultimap
representing the contents
of the ObservableSetMultimap
before the change.public java.util.Set<V> getValuesAdded()
SetMultimapChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via SetMultimapChangeListener.Change.next()
and SetMultimapChangeListener.Change.reset()
.
getValuesAdded
in class SetMultimapChangeListener.Change<K,V>
public java.util.Set<V> getValuesRemoved()
SetMultimapChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via SetMultimapChangeListener.Change.next()
and SetMultimapChangeListener.Change.reset()
.
getValuesRemoved
in class SetMultimapChangeListener.Change<K,V>
public boolean next()
SetMultimapChangeListener.Change
SetMultimapChangeListener.Change.getKey()
, SetMultimapChangeListener.Change.getValuesAdded()
,
and SetMultimapChangeListener.Change.getValuesRemoved()
, SetMultimapChangeListener.Change.wasAdded()
, and
SetMultimapChangeListener.Change.wasRemoved()
. This method has to be called initially to have
the internal cursor point to the first elementary sub-change that is
comprised.next
in class SetMultimapChangeListener.Change<K,V>
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.public void reset()
SetMultimapChangeListener.Change
SetMultimapChangeListener.Change.next()
.reset
in class SetMultimapChangeListener.Change<K,V>
public java.lang.String toString()
toString
in class java.lang.Object
public boolean wasAdded()
SetMultimapChangeListener.Change
ObservableSetMultimap
during this elementary sub-change.
This method depends on the state of the internal cursor that can be
manipulated via SetMultimapChangeListener.Change.next()
and SetMultimapChangeListener.Change.reset()
.
wasAdded
in class SetMultimapChangeListener.Change<K,V>
true
if new values or (key-value) entries were
added to the ObservableSetMultimap
,
false
otherwise.public boolean wasRemoved()
SetMultimapChangeListener.Change
ObservableSetMultimap
in the current elementary sub-change.
This method depends on the state of the internal cursor that can be
manipulated via SetMultimapChangeListener.Change.next()
and SetMultimapChangeListener.Change.reset()
.
wasRemoved
in class SetMultimapChangeListener.Change<K,V>
true
if old values or (key-value) entries were
removed from the ObservableSetMultimap
,
false
otherwise.Copyright (c) 2014 itemis AG and others. All rights reserved.