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

# Class MultisetExpression<E>

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

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

All Implemented Interfaces:
  `Multiset<E>`, `Iterable<E>`, `Collection<E>`, `Observable`, `ObservableObjectValue<ObservableMultiset<E>>`, `ObservableValue<ObservableMultiset<E>>`, `ObservableMultisetValue<E>`, `ObservableMultiset<E>`

Direct Known Subclasses:
  `MultisetBinding`, `ReadOnlyMultisetProperty`

public abstract class MultisetExpression<E> extends Object implements ObservableMultisetValue<E>
A `SetMultimapExpression` is a `ObservableMultisetValue` plus additional convenience methods to generate bindings.

This class provides identical functionality for `Multiset` as `MapExpression` for `Map`, `SetExpression` for `Set`, or `ListExpression` for `List`.

## Property Summary

Properties
Type
Property
Description
`abstract ReadOnlyBooleanProperty`
`empty`
A boolean property that reflects whether the `Multiset` is empty.
`abstract ReadOnlyIntegerProperty`
`size`
An integer property that represents the size of the `Multiset`.

## Nested Class Summary

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

`Multiset.Entry<E extends Object>`

## Constructor Summary

Constructors
Constructor
Description
`MultisetExpression()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`add(E element)`
`int`
`add(E element, int occurrences)`
`boolean`
`addAll(Collection<? extends E> c)`
`StringBinding`
`asString()`
Creates a `StringBinding` that holds the value of the `MultisetExpression` turned into a `String`.
`void`
`clear()`
`boolean`
`contains(Object element)`
`boolean`
`containsAll(Collection<?> elements)`
`int`
`count(Object element)`
`Set<E>`
`elementSet()`
`abstract ReadOnlyBooleanProperty`
`emptyProperty()`
A boolean property that reflects whether the `Multiset` is empty.
`Set<Multiset.Entry<E>>`
`entrySet()`
`ObservableMultiset<E>`
`getValue()`
`boolean`
`isEmpty()`
Gets the value of the property empty.
`BooleanBinding`
`isEqualTo(ObservableMultiset<?> other)`
Creates a new `BooleanBinding` that indicates whether this `ObservableMultiset` is equal to the passed in `ObservableMultiset`.
`BooleanBinding`
`isNotEqualTo(ObservableMultiset<?> other)`
Creates a new `BooleanBinding` that indicates whether this `ObservableMultiset` is not equal to the passed in `ObservableMultiset`.
`BooleanBinding`
`isNotNull()`
Creates a new `BooleanBinding` that indicates if the wrapped `ObservableMultiset` is not `null`.
`BooleanBinding`
`isNull()`
Creates a new `BooleanBinding` that indicates if the wrapped `ObservableMultiset` is `null`.
`Iterator<E>`
`iterator()`
`static <E> MultisetExpression<E>`
`multisetExpression(ObservableMultisetValue<E> multisetValue)`
Returns a `MultisetExpression` that wraps an `ObservableMultisetValue`.
`boolean`
`remove(Object element)`
`int`
`remove(Object element, int occurrences)`
`boolean`
`removeAll(Collection<?> c)`
`boolean`
`replaceAll(Multiset<? extends E> multiset)`
Replaces all the contents of the `ObservableMultiset` with the contents provided by the given `Multiset`.
`boolean`
`retainAll(Collection<?> c)`
`int`
`setCount(E element, int count)`
`boolean`
`setCount(E element, int oldCount, int newCount)`
`int`
`size()`
`abstract ReadOnlyIntegerProperty`
`sizeProperty()`
An integer property that represents the size of the `Multiset`.
`Object[]`
`toArray()`
`<T> T[]`
`toArray(T[] a)`

### 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.Observable

`addListener, removeListener`

### Methods inherited from interface org.eclipse.gef.common.collections.ObservableMultiset

`addListener, removeListener`

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

`get`

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

`addListener, removeListener`

## Property Details

### empty

public abstract ReadOnlyBooleanProperty emptyProperty
A boolean property that reflects whether the `Multiset` is empty.

See Also:
  - `isEmpty()`

### size

public abstract ReadOnlyIntegerProperty sizeProperty
An integer property that represents the size of the `Multiset`.

## Constructor Details

### MultisetExpression

public MultisetExpression()

## Method Details

### multisetExpression

public static <E> MultisetExpression<E> multisetExpression(ObservableMultisetValue<E> multisetValue)
Returns a `MultisetExpression` that wraps an `ObservableMultisetValue`. If the `ObservableMultisetValue` is already a `MultisetExpression`, it will be returned. Otherwise a new concrete `MultisetBinding` is created that is bound to the `ObservableMultisetValue`.

Type Parameters:
  `E` - The element type of the `MultisetExpression`.
Parameters:
  `multisetValue` - The `ObservableMultisetValue` for which to return a `MultisetExpression`.
Returns:
  The passed in `ObservableMultisetValue` if its already a `MultisetExpression`, or a newly created `MultisetBinding` for it.

### add

public boolean add(E element)

Specified by:
  `add` in interface `Collection<E>`
Specified by:
  `add` in interface `Multiset<E>`

### add

public int add(E element, int occurrences)

Specified by:
  `add` in interface `Multiset<E>`

### addAll

public boolean addAll(Collection<? extends E> c)

Specified by:
  `addAll` in interface `Collection<E>`

### asString

public StringBinding asString()
Creates a `StringBinding` that holds the value of the `MultisetExpression` turned into a `String`. If the value of this `SetMultimapExpression` changes, the value of the `StringBinding` will be updated automatically.

Returns:
  A new `StringBinding`.

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<E>`

### contains

public boolean contains(Object element)

Specified by:
  `contains` in interface `Collection<E>`
Specified by:
  `contains` in interface `Multiset<E>`

### containsAll

public boolean containsAll(Collection<?> elements)

Specified by:
  `containsAll` in interface `Collection<E>`
Specified by:
  `containsAll` in interface `Multiset<E>`

### count

public int count(Object element)

Specified by:
  `count` in interface `Multiset<E>`

### elementSet

public Set<E> elementSet()

Specified by:
  `elementSet` in interface `Multiset<E>`

### emptyProperty

public abstract ReadOnlyBooleanProperty emptyProperty()
A boolean property that reflects whether the `Multiset` is empty.

See Also:
  - `isEmpty()`

### entrySet

public Set<Multiset.Entry<E>> entrySet()

Specified by:
  `entrySet` in interface `Multiset<E>`

### getValue

public ObservableMultiset<E> getValue()

Specified by:
  `getValue` in interface `ObservableValue<E>`

### isEmpty

public boolean isEmpty()
Gets the value of the property empty.

Specified by:
  `isEmpty` in interface `Collection<E>`
Property description:
  A boolean property that reflects whether the `Multiset` is empty.

### isEqualTo

public BooleanBinding isEqualTo(ObservableMultiset<?> other)
Creates a new `BooleanBinding` that indicates whether this `ObservableMultiset` is equal to the passed in `ObservableMultiset`.

Parameters:
  `other` - The `ObservableMultiset` to compare this `ObservableMultiset` to.
Returns:
  A new `BooleanBinding`.

### isNotEqualTo

public BooleanBinding isNotEqualTo(ObservableMultiset<?> other)
Creates a new `BooleanBinding` that indicates whether this `ObservableMultiset` is not equal to the passed in `ObservableMultiset`.

Parameters:
  `other` - The `ObservableMultiset` to compare this `ObservableMultiset` to.
Returns:
  A new `BooleanBinding`.

### isNotNull

public BooleanBinding isNotNull()
Creates a new `BooleanBinding` that indicates if the wrapped `ObservableMultiset` is not `null`.

Returns:
  A new `BooleanBinding`.

### isNull

public BooleanBinding isNull()
Creates a new `BooleanBinding` that indicates if the wrapped `ObservableMultiset` is `null`.

Returns:
  A new `BooleanBinding`.

### iterator

public Iterator<E> iterator()

Specified by:
  `iterator` in interface `Collection<E>`
Specified by:
  `iterator` in interface `Iterable<E>`
Specified by:
  `iterator` in interface `Multiset<E>`

### remove

public boolean remove(Object element)

Specified by:
  `remove` in interface `Collection<E>`
Specified by:
  `remove` in interface `Multiset<E>`

### remove

public int remove(Object element, int occurrences)

Specified by:
  `remove` in interface `Multiset<E>`

### removeAll

public boolean removeAll(Collection<?> c)

Specified by:
  `removeAll` in interface `Collection<E>`
Specified by:
  `removeAll` in interface `Multiset<E>`

### replaceAll

public boolean replaceAll(Multiset<? extends E> multiset)
Description copied from interface: `ObservableMultiset`
Replaces all the contents of the `ObservableMultiset` with the contents provided by the given `Multiset`.

Specified by:
  `replaceAll` in interface `ObservableMultiset<E>`
Parameters:
  `multiset` - The `Multiset` whose values should be used to replace those of this `ObservableMultiset`.
Returns:
  Whether this map was changed through the replace operation.

### retainAll

public boolean retainAll(Collection<?> c)

Specified by:
  `retainAll` in interface `Collection<E>`
Specified by:
  `retainAll` in interface `Multiset<E>`

### setCount

public int setCount(E element, int count)

Specified by:
  `setCount` in interface `Multiset<E>`

### setCount

public boolean setCount(E element, int oldCount, int newCount)

Specified by:
  `setCount` in interface `Multiset<E>`

### size

public int size()

Specified by:
  `size` in interface `Collection<E>`
Specified by:
  `size` in interface `Multiset<E>`

### sizeProperty

public abstract ReadOnlyIntegerProperty sizeProperty()
An integer property that represents the size of the `Multiset`.

### toArray

public Object[] toArray()

Specified by:
  `toArray` in interface `Collection<E>`

### toArray

public <T> T[] toArray(T[] a)

Specified by:
  `toArray` in interface `Collection<E>`