org.eclipse.viatra.query.runtime.matchers.util

## Class EclipseCollectionsMultiset<T>

- java.lang.Object
- - org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
  - - org.eclipse.viatra.query.runtime.matchers.util.EclipseCollectionsBagMemory<T>
    - - org.eclipse.viatra.query.runtime.matchers.util.EclipseCollectionsMultiset<T>

- All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Iterable<T>, org.eclipse.collections.api.IntIterable, org.eclipse.collections.api.map.primitive.MutableObjectIntMap<T>, org.eclipse.collections.api.map.primitive.ObjectIntMap<T>, org.eclipse.collections.api.PrimitiveIterable, Clearable, IMemory<T>, IMemoryView<T>, IMultiset<T>

      public class EclipseCollectionsMultiset<T>
      extends EclipseCollectionsBagMemory<T>
      implements IMultiset<T>

  Since:
    1.7
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap

      `EMPTY_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EclipseCollectionsMultiset()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addOne(T value)` Adds one value occurrence to the memory.
    `boolean` | `addPositive(T value, int count)` Adds the given number of occurrences to the memory.
    `boolean` | `addSigned(T value, int count)` Adds the given number of occurrences to the memory.
    `boolean` | `removeOne(T value)` Removes one occurrence of the given value from the memory.
    `protected boolean` | `removeOneInternal(T value, boolean throwIfImpossible)`
    `boolean` | `removeOneOrNop(T value)` Removes one occurrence of the given value from the memory, if possible.

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.matchers.util.EclipseCollectionsBagMemory

      `clearAllOf, containsNonZero, containsNonZeroUnsafe, distinctValues, equals, forEachEntryWithMultiplicities, getCount, getCountUnsafe, hashCode, iterator, toString`

    - ### Methods inherited from class org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap

      `addToValue, allocateTable, allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, asSynchronized, asUnmodifiable, average, chunk, clear, collect, compact, contains, containsAll, containsAll, containsKey, containsValue, count, detectIfNone, each, flipUniqueValues, forEach, forEachKey, forEachKeyValue, forEachValue, get, getIfAbsent, getIfAbsentPut, getIfAbsentPut, getIfAbsentPutWith, getIfAbsentPutWithKey, getOrThrow, injectInto, intIterator, isEmpty, keySet, keysView, keyValuesView, makeString, makeString, makeString, max, maxIfEmpty, median, min, minIfEmpty, newMap, newWithKeysValues, newWithKeysValues, newWithKeysValues, newWithKeysValues, noneSatisfy, notEmpty, put, putAll, readExternal, reject, reject, remove, removeKey, removeKeyIfAbsent, select, select, size, sum, toArray, toBag, toImmutable, toList, toSet, toSortedArray, toSortedList, updateValue, updateValues, values, withKeysValues, withKeysValues, withKeysValues, withKeyValue, withoutAllKeys, withoutKey, writeExternal`

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

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

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.util.IMemory

      `clear, clearAllOf`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.util.IMemoryView

      `asMap, asStream, containsNonZero, containsNonZeroUnsafe, distinctValues, entriesWithMultiplicities, equals, forEachEntryWithMultiplicities, fromMap, getCount, getCountUnsafe, hashCode, isEmpty, size, theContainedVersionOf, theContainedVersionOfUnsafe`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, iterator, spliterator`

    - ### Methods inherited from interface org.eclipse.collections.api.map.primitive.MutableObjectIntMap

      `putPair, tap, withAllKeyValues`

    - ### Methods inherited from interface org.eclipse.collections.api.IntIterable

      `averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, flatCollect, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics`

- - ### Constructor Detail

    - #### EclipseCollectionsMultiset

          public EclipseCollectionsMultiset()

  - ### Method Detail

    - #### addOne

          public boolean addOne(T value)

      Description copied from interface: `IMemory`
      Adds one value occurrence to the memory.
      Specified by:
        `addOne` in interface `IMemory<T>`
      Returns:
        true if the tuple was not present before in the memory, or (in case of `IDeltaBag`) is no longer present in the memory

    - #### addPositive

          public boolean addPositive(T value,
                                     int count)

      Description copied from interface: `IMultiset`
      Adds the given number of occurrences to the memory. The count value must be a positive number.
      Specified by:
        `addPositive` in interface `IMultiset<T>`
        `count` - the number of occurrences
      Returns:
        true if the tuple was not present before in the memory

    - #### addSigned

          public boolean addSigned(T value,
                                   int count)

      Description copied from interface: `IMemory`
      Adds the given number of occurrences to the memory. The count value may or may not be negative.

      Precondition if `IMultiset`: at least the given amount of occurrences exist, if count is negative.

      Precondition if `ISetMemory`: count is +1 or -1, the latter is only allowed if the set contains the value.

      Specified by:
        `addSigned` in interface `IMemory<T>`
        `count` - the number of occurrences
      Returns:
        true if the tuple was not present before in the memory, or is no longer present in the memory

    - #### removeOne

          public boolean removeOne(T value)

      Description copied from interface: `IMemory`
      Removes one occurrence of the given value from the memory.

      Precondition if `IMultiset` or `ISetMemory`: the value must have a positive amount of occurrences in the memory.

      Specified by:
        `removeOne` in interface `IMemory<T>`
      Returns:
        true if this was the the last occurrence of the value, or (in case of `IDeltaBag`) is the first negative occurrence of the value

    - #### removeOneOrNop

          public boolean removeOneOrNop(T value)

      Description copied from interface: `IMemory`
      Removes one occurrence of the given value from the memory, if possible.

      Memory is unchanged and false is returned if `IMultiset` or `ISetMemory` and value had no occurrences in the memory

      Specified by:
        `removeOneOrNop` in interface `IMemory<T>`
      Returns:
        true if this was the the last occurrence of the value, or (in case of `IDeltaBag`) is the first negative occurrence of the value

    - #### removeOneInternal

          protected boolean removeOneInternal(T value,
                                              boolean throwIfImpossible)

      Since:
        2.3