org.eclipse.gef.common.collections

## Class MultisetListenerHelper<E>

- java.lang.Object
- - org.eclipse.gef.common.collections.MultisetListenerHelper<E>

Type Parameters:
  `E` - The element type of the `ObservableMultiset`.

Direct Known Subclasses:
  MultisetExpressionHelper

    public class MultisetListenerHelper<E>
    extends Object

A utility class to support change notifications for an `ObservableMultiset`.

### Nested Class Summary

Nested Classes
`static class` `MultisetListenerHelper.AtomicChange<E>` A simple implementation of an `MultisetChangeListener.Change`.
`static class` `MultisetListenerHelper.ElementarySubChange<E>` An elementary change related to a single element of a `Multiset`.

### Constructor Summary

Constructors
Constructor and Description
`MultisetListenerHelper(ObservableMultiset<E> source)` Constructs a new `MultisetListenerHelper` for the given source `ObservableMultiset`.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addListener(InvalidationListener listener)` Adds a new `InvalidationListener` to this `MultisetListenerHelper`.
`void` `addListener(MultisetChangeListener<? super E> listener)` Adds a new `SetMultimapChangeListener` to this `MultisetListenerHelper`.
`void` `fireValueChangedEvent(MultisetChangeListener.Change<? extends E> change)` Notifies all attached `InvalidationListener`s and `MultisetChangeListener`s about the change.
`protected ObservableMultiset<E>` `getSource()` Returns the source `ObservableMultiset` this `MultisetListenerHelper` is bound to, which is used in change notifications.
`protected void` `notifyInvalidationListeners()` Notifies all registered `InvalidationListener`s.
`protected void` `notifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)` Notifies the attached `MultisetChangeListener`s about the related change.
`void` `removeListener(InvalidationListener listener)` Removes the given `InvalidationListener` from this `MultisetListenerHelper`.
`void` `removeListener(MultisetChangeListener<? super E> listener)` Removes the given `MultisetChangeListener` from this `MultisetListenerHelper`.

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

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

### Constructor Detail

#### MultisetListenerHelper

    public MultisetListenerHelper(ObservableMultiset<E> source)

Constructs a new `MultisetListenerHelper` for the given source `ObservableMultiset`.

Parameters:
  `source` - The `ObservableMultiset` to use as source in change notifications.

### Method Detail

#### addListener

    public void addListener(InvalidationListener listener)

Adds a new `InvalidationListener` to this `MultisetListenerHelper`. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.

Parameters:
  `listener` - The listener to add.

#### addListener

    public void addListener(MultisetChangeListener<? super E> listener)

Adds a new `SetMultimapChangeListener` to this `MultisetListenerHelper`. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.

Parameters:
  `listener` - The listener to add.

#### fireValueChangedEvent

    public void fireValueChangedEvent(MultisetChangeListener.Change<? extends E> change)

Notifies all attached `InvalidationListener`s and `MultisetChangeListener`s about the change.

Parameters:
  `change` - The change to notify listeners about.

#### getSource

    protected ObservableMultiset<E> getSource()

Returns the source `ObservableMultiset` this `MultisetListenerHelper` is bound to, which is used in change notifications.

Returns:
  The source `ObservableMultiset`.

#### notifyInvalidationListeners

    protected void notifyInvalidationListeners()

Notifies all registered `InvalidationListener`s.

#### notifyMultisetChangeListeners

    protected void notifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)

Notifies the attached `MultisetChangeListener`s about the related change.

Parameters:
  `change` - The applied change.

#### removeListener

    public void removeListener(InvalidationListener listener)

Removes the given `InvalidationListener` from this `MultisetListenerHelper`. If its was registered more than once, removes one occurrence.

Parameters:
  `listener` - The listener to remove.

#### removeListener

    public void removeListener(MultisetChangeListener<? super E> listener)

Removes the given `MultisetChangeListener` from this `MultisetListenerHelper`. If its was registered more than once, removes one occurrence.

Parameters:
  `listener` - The listener to remove.