Package org.eclipse.gef.common.beans.binding

## Class MultisetBinding<E>

- java.lang.Object
- - org.eclipse.gef.common.beans.binding.MultisetExpression<E>
  - - org.eclipse.gef.common.beans.binding.MultisetBinding<E>

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

All Implemented Interfaces:
  `Multiset<E>`, `java.lang.Iterable<E>`, `java.util.Collection<E>`, `javafx.beans.binding.Binding<ObservableMultiset<E>>`, `javafx.beans.Observable`, `javafx.beans.value.ObservableObjectValue<ObservableMultiset<E>>`, `javafx.beans.value.ObservableValue<ObservableMultiset<E>>`, `ObservableMultisetValue<E>`, `ObservableMultiset<E>`

    public abstract class MultisetBinding<E>
    extends MultisetExpression<E>
    implements javafx.beans.binding.Binding<ObservableMultiset<E>>

An abstract base class that provides functionality needed to realize a `Binding` on an `ObservableMultiset`.

This class provides identical functionality for `Multiset` as `MapBinding` for `Map`, `SetBinding` for `Set`, or `ListBinding` for `List`.

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.google.common.collect.Multiset

`Multiset.Entry<E extends java.lang.Object>`

### Constructor Summary

Constructors
`MultisetBinding()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `addListener​(javafx.beans.InvalidationListener listener)`
`void` `addListener​(javafx.beans.value.ChangeListener<? super ObservableMultiset<E>> listener)`
`void` `addListener​(MultisetChangeListener<? super E> listener)` Adds a `MultisetChangeListener` to this `ObservableMultiset`.
`protected void` `bind​(javafx.beans.Observable... dependencies)` Start observing the given dependencies for changes.
`protected abstract ObservableMultiset<E>` `computeValue()` Computes the current value of this `MultisetBinding`.
`void` `dispose()`
`javafx.beans.property.ReadOnlyBooleanProperty` `emptyProperty()` A boolean property that reflects whether the `Multiset` is empty.
`protected void` `fireValueChangedEvent()` Fires notifications to all attached `InvalidationListeners`, `ChangeListeners`, and `SetMultimapChangeListeners`.
`protected void` `fireValueChangedEvent​(MultisetChangeListener.Change<? extends E> change)` Fires notifications to all attached `InvalidationListeners`, `ChangeListeners`, and `MultisetChangeListeners`.
`ObservableMultiset<E>` `get()`
`javafx.collections.ObservableList<?>` `getDependencies()`
`void` `invalidate()`
`protected void` `invalidated()` Can be overwritten by subclasses to receive invalidation notifications.
`boolean` `isValid()`
`void` `removeListener​(javafx.beans.InvalidationListener listener)`
`void` `removeListener​(javafx.beans.value.ChangeListener<? super ObservableMultiset<E>> listener)`
`void` `removeListener​(MultisetChangeListener<? super E> listener)` Removes a `MultisetChangeListener` from this `ObservableMultiset`.
`javafx.beans.property.ReadOnlyIntegerProperty` `sizeProperty()` An integer property that represents the size of the `Multiset`.
`protected void` `unbind​(javafx.beans.Observable... dependencies)` Stops observing the dependencies for changes.

### Methods inherited from class org.eclipse.gef.common.beans.binding.MultisetExpression

`add, add, addAll, asString, clear, contains, containsAll, count, elementSet, entrySet, getValue, isEmpty, isEqualTo, isNotEqualTo, isNotNull, isNull, iterator, multisetExpression, remove, remove, removeAll, replaceAll, retainAll, setCount, setCount, size, toArray, toArray`

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

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

### Methods inherited from interface java.util.Collection

`parallelStream, removeIf, stream, toArray`

### Methods inherited from interface com.google.common.collect.Multiset

`equals, forEach, forEachEntry, hashCode, spliterator, toString`

### Methods inherited from interface javafx.beans.value.ObservableValue

`getValue`

### Constructor Detail

#### MultisetBinding

    public MultisetBinding()

### Method Detail

#### addListener

    public void addListener​(javafx.beans.value.ChangeListener<? super ObservableMultiset<E>> listener)

Specified by:
  `addListener` in interface `javafx.beans.value.ObservableValue<E>`

#### addListener

    public void addListener​(javafx.beans.InvalidationListener listener)

Specified by:
  `addListener` in interface `javafx.beans.Observable`

#### addListener

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

Description copied from interface: `ObservableMultiset`
Adds a `MultisetChangeListener` to this `ObservableMultiset`. If the same listener is registered more than once, it will be notified more than once.

Specified by:
  `addListener` in interface `ObservableMultiset<E>`
Parameters:
  `listener` - The `MultisetChangeListener` to add.

#### bind

    protected void bind​(javafx.beans.Observable... dependencies)

Start observing the given dependencies for changes. If the value of one of the dependencies changes, the binding is marked as invalid.

Parameters:
  `dependencies` - The dependencies to observe.

#### computeValue

    protected abstract ObservableMultiset<E> computeValue()

Computes the current value of this `MultisetBinding`.

Returns:
  The current value of this `MultisetBinding`.

#### dispose

    public void dispose()

Specified by:
  `dispose` in interface `javafx.beans.binding.Binding<E>`

#### emptyProperty

    public javafx.beans.property.ReadOnlyBooleanProperty emptyProperty()

Description copied from class: `MultisetExpression`
A boolean property that reflects whether the `Multiset` is empty.

Specified by:
  `emptyProperty` in class `MultisetExpression<E>`
Returns:
  A read-only property.

#### fireValueChangedEvent

    protected void fireValueChangedEvent()

Fires notifications to all attached `InvalidationListeners`, `ChangeListeners`, and `SetMultimapChangeListeners`.

#### fireValueChangedEvent

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

Fires notifications to all attached `InvalidationListeners`, `ChangeListeners`, and `MultisetChangeListeners`.

Parameters:
  `change` - the change that needs to be propagated

#### get

    public ObservableMultiset<E> get()

Specified by:
  `get` in interface `javafx.beans.value.ObservableObjectValue<E>`

#### getDependencies

    public javafx.collections.ObservableList<?> getDependencies()

Specified by:
  `getDependencies` in interface `javafx.beans.binding.Binding<E>`

#### invalidate

    public void invalidate()

Specified by:
  `invalidate` in interface `javafx.beans.binding.Binding<E>`

#### invalidated

    protected void invalidated()

Can be overwritten by subclasses to receive invalidation notifications. Does nothing by default.

#### isValid

    public boolean isValid()

Specified by:
  `isValid` in interface `javafx.beans.binding.Binding<E>`

#### removeListener

    public void removeListener​(javafx.beans.value.ChangeListener<? super ObservableMultiset<E>> listener)

Specified by:
  `removeListener` in interface `javafx.beans.value.ObservableValue<E>`

#### removeListener

    public void removeListener​(javafx.beans.InvalidationListener listener)

Specified by:
  `removeListener` in interface `javafx.beans.Observable`

#### removeListener

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

Description copied from interface: `ObservableMultiset`
Removes a `MultisetChangeListener` from this `ObservableMultiset`. Will do nothing if the listener was not attached to this `ObservableMultiset`. If it was added more than once, then only the first occurrence will be removed.

Specified by:
  `removeListener` in interface `ObservableMultiset<E>`
Parameters:
  `listener` - The `MultisetChangeListener` to remove.

#### sizeProperty

    public javafx.beans.property.ReadOnlyIntegerProperty sizeProperty()

Description copied from class: `MultisetExpression`
An integer property that represents the size of the `Multiset`.

Specified by:
  `sizeProperty` in class `MultisetExpression<E>`
Returns:
  A read-only property.

#### unbind

    protected void unbind​(javafx.beans.Observable... dependencies)

Stops observing the dependencies for changes. The binding will no longer be marked as invalid if one of the dependencies changes.

Parameters:
  `dependencies` - The dependencies to stop observing.