E
- The element type of the source ObservableMultiset
.public static class MultisetListenerHelper.AtomicChange<E> extends MultisetChangeListener.Change<E>
MultisetChangeListener.Change
.Constructor and Description |
---|
AtomicChange(ObservableMultiset<E> source,
Multiset<E> previousContents,
java.util.List<MultisetListenerHelper.ElementarySubChange<E>> elementarySubChanges)
Creates a new
MultisetListenerHelper.AtomicChange that
represents a change comprising multiple elementary sub-changesO. |
AtomicChange(ObservableMultiset<E> source,
Multiset<E> previousContents,
MultisetListenerHelper.ElementarySubChange<E> elementarySubChange)
Creates a new
MultisetListenerHelper.AtomicChange that
represents a change comprising a single elementary sub-change. |
AtomicChange(ObservableMultiset<E> source,
MultisetChangeListener.Change<? extends E> 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 |
---|---|
int |
getAddCount()
Returns how often an element has been added in the current elementary
sub-change, if one has been added.
|
E |
getElement()
Retrieves the element that was altered in the current elementary
sub-change.
|
Multiset<E> |
getPreviousContents()
Returns an unmodifiable
Multiset that contains the previous
contents of the source ObservableMultiset before the atomic
change was applied. |
int |
getRemoveCount()
Returns how often an element has been removed in the current
elementary sub-change, if one has been removed.
|
boolean |
next()
Places the internal cursor on the next elementary sub-change, so that
it be processed using
MultisetChangeListener.Change.getElement() , MultisetChangeListener.Change.getAddCount() ,
and MultisetChangeListener.Change.getRemoveCount() . |
void |
reset()
Reset the internal cursor to the initial state, so that the first
elementary sub-change can be accessed by calling
MultisetChangeListener.Change.next() . |
java.lang.String |
toString() |
getMultiset
public AtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, MultisetListenerHelper.ElementarySubChange<E> elementarySubChange)
MultisetListenerHelper.AtomicChange
that
represents a change comprising a single elementary sub-change.source
- The source ObservableMultiset
from which the
change originated.previousContents
- The previous contents of the ObservableMultiset
before the change was applied.elementarySubChange
- The elementary sub-change that has been applied.public AtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, java.util.List<MultisetListenerHelper.ElementarySubChange<E>> 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(ObservableMultiset<E> source, MultisetChangeListener.Change<? extends E> 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 int getAddCount()
MultisetChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via MultisetChangeListener.Change.next()
and MultisetChangeListener.Change.reset()
.
getAddCount
in class MultisetChangeListener.Change<E>
public E getElement()
MultisetChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via MultisetChangeListener.Change.next()
and MultisetChangeListener.Change.reset()
.
getElement
in class MultisetChangeListener.Change<E>
public Multiset<E> getPreviousContents()
MultisetChangeListener.Change
Multiset
that contains the previous
contents of the source ObservableMultiset
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 MultisetChangeListener.Change<E>
Multiset
representing the contents of
the ObservableMultiset
before the change.public int getRemoveCount()
MultisetChangeListener.Change
This method depends on the state of the internal cursor that can be
manipulated via MultisetChangeListener.Change.next()
and MultisetChangeListener.Change.reset()
.
getRemoveCount
in class MultisetChangeListener.Change<E>
public boolean next()
MultisetChangeListener.Change
MultisetChangeListener.Change.getElement()
, MultisetChangeListener.Change.getAddCount()
,
and MultisetChangeListener.Change.getRemoveCount()
. 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 MultisetChangeListener.Change<E>
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()
MultisetChangeListener.Change
MultisetChangeListener.Change.next()
.reset
in class MultisetChangeListener.Change<E>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2014 itemis AG and others. All rights reserved.