Package org.eclipse.gef.common.collections

## Class SetMultimapListenerHelper.AtomicChange<K,​V>

- java.lang.Object
- - org.eclipse.gef.common.collections.SetMultimapChangeListener.Change<K,​V>
  - - org.eclipse.gef.common.collections.SetMultimapListenerHelper.AtomicChange<K,​V>

Type Parameters:
  `K` - The key type of the source `ObservableSetMultimap`.
  `V` - The value type of the source `ObservableSetMultimap`.

Enclosing class:
  SetMultimapListenerHelper<K,​V>

    public static class SetMultimapListenerHelper.AtomicChange<K,​V>
    extends SetMultimapChangeListener.Change<K,​V>

A simple implementation of an `SetMultimapChangeListener.Change`.

### Constructor Summary

Constructors
`AtomicChange​(ObservableSetMultimap<K,​V> source, 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, 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.

### Method Summary

All Methods Instance Methods Concrete Methods
`K` `getKey()` The key associated with the current elementary sub-change.
`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.

### Methods inherited from class org.eclipse.gef.common.collections.SetMultimapChangeListener.Change

`getSetMultimap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### AtomicChange

    public AtomicChange​(ObservableSetMultimap<K,​V> source,
                        SetMultimap<K,​V> previousContents,
                        SetMultimapListenerHelper.ElementarySubChange<K,​V> elementarySubChange)

Creates a new `SetMultimapListenerHelper.AtomicChange` that represents a change comprising a single elementary sub-change.

Parameters:
  `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.

#### AtomicChange

    public AtomicChange​(ObservableSetMultimap<K,​V> source,
                        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.

Parameters:
  `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.

#### AtomicChange

    public 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.

This is basically used to allow properties wrapping an `ObservableMultiset` to re-fire change events of their wrapped `ObservableMultiset` with themselves as source.

Parameters:
  `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.

### Method Detail

#### getKey

    public K getKey()

Description copied from class: `SetMultimapChangeListener.Change`
The key associated with 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()`.

Specified by:
  `getKey` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  The key for which values were added or removed.

#### getPreviousContents

    public SetMultimap<K,​V> getPreviousContents()

Description copied from class: `SetMultimapChangeListener.Change`
Returns an unmodifiable `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.

Specified by:
  `getPreviousContents` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  An unmodifiable `SetMultimap` representing the contents of the `ObservableSetMultimap` before the change.

#### getValuesAdded

    public java.util.Set<V> getValuesAdded()

Description copied from class: `SetMultimapChangeListener.Change`
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 `SetMultimapChangeListener.Change.next()` and `SetMultimapChangeListener.Change.reset()`.

Specified by:
  `getValuesAdded` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  The values that have become associated with the key.

#### getValuesRemoved

    public java.util.Set<V> getValuesRemoved()

Description copied from class: `SetMultimapChangeListener.Change`
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 `SetMultimapChangeListener.Change.next()` and `SetMultimapChangeListener.Change.reset()`.

Specified by:
  `getValuesRemoved` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  The values previously associated with the key.

#### next

    public boolean next()

Description copied from class: `SetMultimapChangeListener.Change`
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()`. This method has to be called initially to have the internal cursor point to the first elementary sub-change that is comprised.

Specified by:
  `next` in class `SetMultimapChangeListener.Change<K,​V>`
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 void reset()

Description copied from class: `SetMultimapChangeListener.Change`
Reset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by calling `SetMultimapChangeListener.Change.next()`.

Specified by:
  `reset` in class `SetMultimapChangeListener.Change<K,​V>`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### wasAdded

    public boolean wasAdded()

Description copied from class: `SetMultimapChangeListener.Change`
Indicates whether elements were added to the `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()`.

Specified by:
  `wasAdded` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  `true` if new values or (key-value) entries were added to the `ObservableSetMultimap`, `false` otherwise.

#### wasRemoved

    public boolean wasRemoved()

Description copied from class: `SetMultimapChangeListener.Change`
Indicates whether elements were removed from the `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()`.

Specified by:
  `wasRemoved` in class `SetMultimapChangeListener.Change<K,​V>`
Returns:
  `true` if old values or (key-value) entries were removed from the `ObservableSetMultimap`, `false` otherwise.