Class MultisetListenerHelper.AtomicChange<E>
- Type Parameters:
E- The element type of the sourceObservableMultiset.
- Enclosing class:
- MultisetListenerHelper<E>
MultisetChangeListener.Change.-
Constructor Summary
ConstructorsConstructorDescriptionAtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, List<MultisetListenerHelper.ElementarySubChange<E>> elementarySubChanges) Creates a newMultisetListenerHelper.AtomicChangethat represents a change comprising multiple elementary sub-changesO.AtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, MultisetListenerHelper.ElementarySubChange<E> elementarySubChange) Creates a newMultisetListenerHelper.AtomicChangethat represents a change comprising a single elementary sub-change.AtomicChange(ObservableMultiset<E> source, MultisetChangeListener.Change<? extends E> change) Creates a newMultisetListenerHelper.AtomicChangefor the passed in source, based on the data provided in the passed-in change. -
Method Summary
Modifier and TypeMethodDescriptionintReturns how often an element has been added in the current elementary sub-change, if one has been added.Retrieves the element that was altered in the current elementary sub-change.Returns an unmodifiableMultisetthat contains the previous contents of the sourceObservableMultisetbefore the atomic change was applied.intReturns how often an element has been removed in the current elementary sub-change, if one has been removed.booleannext()Places the internal cursor on the next elementary sub-change, so that it be processed usingMultisetChangeListener.Change.getElement(),MultisetChangeListener.Change.getAddCount(), andMultisetChangeListener.Change.getRemoveCount().voidreset()Reset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by callingMultisetChangeListener.Change.next().toString()Methods inherited from class org.eclipse.gef.common.collections.MultisetChangeListener.Change
getMultiset
-
Constructor Details
-
AtomicChange
public AtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, MultisetListenerHelper.ElementarySubChange<E> elementarySubChange) Creates a newMultisetListenerHelper.AtomicChangethat represents a change comprising a single elementary sub-change.- Parameters:
source- The sourceObservableMultisetfrom which the change originated.previousContents- The previous contents of theObservableMultisetbefore the change was applied.elementarySubChange- The elementary sub-change that has been applied.
-
AtomicChange
public AtomicChange(ObservableMultiset<E> source, Multiset<E> previousContents, List<MultisetListenerHelper.ElementarySubChange<E>> elementarySubChanges) Creates a newMultisetListenerHelper.AtomicChangethat represents a change comprising multiple elementary sub-changesO.- Parameters:
source- The sourceObservableMultisetfrom which the change originated.previousContents- The previous contents of theObservableMultisetbefore the change was applied.elementarySubChanges- The elementary sub-changes that have been applied as part of this change.
-
AtomicChange
public AtomicChange(ObservableMultiset<E> source, MultisetChangeListener.Change<? extends E> change) Creates a newMultisetListenerHelper.AtomicChangefor the passed in source, based on the data provided in the passed-in change.This is basically used to allow properties wrapping an
ObservableMultisetto re-fire change events of their wrappedObservableMultisetwith themselves as source.- Parameters:
source- The new sourceObservableMultiset.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.
-
-
Method Details
-
getAddCount
public int getAddCount()Description copied from class:MultisetChangeListener.ChangeReturns how often an element has been added in the current elementary sub-change, if one has been added.This method depends on the state of the internal cursor that can be manipulated via
MultisetChangeListener.Change.next()andMultisetChangeListener.Change.reset().- Specified by:
getAddCountin classMultisetChangeListener.Change<E>- Returns:
- The number of occurrences that have been added.
-
getElement
Description copied from class:MultisetChangeListener.ChangeRetrieves the element that was altered in the current elementary sub-change.This method depends on the state of the internal cursor that can be manipulated via
MultisetChangeListener.Change.next()andMultisetChangeListener.Change.reset().- Specified by:
getElementin classMultisetChangeListener.Change<E>- Returns:
- The added element in case an element was added.
-
getPreviousContents
Description copied from class:MultisetChangeListener.ChangeReturns an unmodifiableMultisetthat contains the previous contents of the sourceObservableMultisetbefore 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.
- Specified by:
getPreviousContentsin classMultisetChangeListener.Change<E>- Returns:
- An unmodifiable
Multisetrepresenting the contents of theObservableMultisetbefore the change.
-
getRemoveCount
public int getRemoveCount()Description copied from class:MultisetChangeListener.ChangeReturns how often an element has been removed in the current elementary sub-change, if one has been removed.This method depends on the state of the internal cursor that can be manipulated via
MultisetChangeListener.Change.next()andMultisetChangeListener.Change.reset().- Specified by:
getRemoveCountin classMultisetChangeListener.Change<E>- Returns:
- The number of occurrences that have been removed.
-
next
public boolean next()Description copied from class:MultisetChangeListener.ChangePlaces the internal cursor on the next elementary sub-change, so that it be processed usingMultisetChangeListener.Change.getElement(),MultisetChangeListener.Change.getAddCount(), andMultisetChangeListener.Change.getRemoveCount(). This method has to be called initially to have the internal cursor point to the first elementary sub-change that is comprised.- Specified by:
nextin classMultisetChangeListener.Change<E>- Returns:
trueif the internal cursor could be switched to the next elementary sub-change,falseif the current elementary sub-change was the last change that is comprised.
-
reset
public void reset()Description copied from class:MultisetChangeListener.ChangeReset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by callingMultisetChangeListener.Change.next().- Specified by:
resetin classMultisetChangeListener.Change<E>
-
toString
-