org.eclipse.gef.common.collections

## Class SetMultimapChangeListener.Change<K,V>

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

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

Direct Known Subclasses:
  SetMultimapListenerHelper.AtomicChange

Enclosing interface:
  SetMultimapChangeListener<K,V>

    public abstract static class SetMultimapChangeListener.Change<K,V>
    extends Object

Represents an elementary change done to an `ObservableSetMultimap`, related to a single key but to potentially multiple values.

### Constructor Summary

Constructors
Constructor and Description
`Change(ObservableSetMultimap<K,V> source)` Creates a new (atomic) change associated with the given source `ObservableSetMultimap`.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract K` `getKey()` The key associated with the current elementary sub-change.
`abstract 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.
`ObservableSetMultimap<K,V>` `getSetMultimap()` The source `ObservableSetMultimap` this (atomic) change is associated with.
`abstract Set<V>` `getValuesAdded()` Retrieves the values that were added for the given key in the current elementary sub-change.
`abstract Set<V>` `getValuesRemoved()` 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 using `getKey()`, `getValuesAdded()`, and `getValuesRemoved()`, `wasAdded()`, and `wasRemoved()`.
`abstract void` `reset()` Reset the internal cursor to the initial state, so that the first elementary sub-change can be accessed by calling `next()`.
`abstract boolean` `wasAdded()` Indicates whether elements were added to the `ObservableSetMultimap` during this elementary sub-change.
`abstract boolean` `wasRemoved()` Indicates whether elements were removed from the `ObservableSetMultimap` in the current elementary sub-change.

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

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

### Constructor Detail

#### Change

    public Change(ObservableSetMultimap<K,V> source)

Creates a new (atomic) change associated with the given source `ObservableSetMultimap`.

Parameters:
  `source` - The source of the change.

### Method Detail

#### getKey

    public abstract K 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()` and `reset()`.

Returns:
  The key for which values were added or removed.

#### getPreviousContents

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

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 the `ObservableSetMultimap` before the change.

#### getSetMultimap

    public ObservableSetMultimap<K,V> getSetMultimap()

The source `ObservableSetMultimap` 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

    public abstract Set<V> 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()` and `reset()`.

Returns:
  The values that have become associated with the key.

#### getValuesRemoved

    public abstract Set<V> 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()` and `reset()`.

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 using `getKey()`, `getValuesAdded()`, and `getValuesRemoved()`, `wasAdded()`, and `wasRemoved()`. 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 calling `next()`.

#### wasAdded

    public abstract boolean wasAdded()

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 `next()` and `reset()`.

Returns:
  `true` if new values or (key-value) entries were added to the `ObservableSetMultimap`, `false` otherwise.

#### wasRemoved

    public abstract boolean wasRemoved()

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 `next()` and `reset()`.

Returns:
  `true` if old values or (key-value) entries were removed from the `ObservableSetMultimap`, `false` otherwise.