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

## Interface ISetMemory<T>

- All Superinterfaces:
    Clearable, IMemory<T>, IMemoryView<T>, java.lang.Iterable<T>
  All Known Implementing Classes:
    EclipseCollectionsLongSetMemory, EclipseCollectionsSetMemory

      public interface ISetMemory<T>
      extends IMemory<T>

  An `IMemory` that always contains values with a 0 or +1 multiplicity.

  In case a write operation causes underflow or overflow, an `IllegalStateException` is thrown.

  Since:
    2.0

- - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `forEachEntryWithMultiplicities(java.util.function.BiConsumer<T,java.lang.Integer> entryConsumer)` Process contained values with their multiplicities
    `default boolean` | `removeOne(T value)` Removes one occurrence of the given value from the memory.

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

      `addOne, addSigned, clear, clearAllOf, removeOneOrNop`

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

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

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

      `forEach, iterator, spliterator`

- - ### Method Detail

    - #### forEachEntryWithMultiplicities

          default void forEachEntryWithMultiplicities(java.util.function.BiConsumer<T,java.lang.Integer> entryConsumer)

      Description copied from interface: `IMemoryView`
      Process contained values with their multiplicities
      Specified by:
        `forEachEntryWithMultiplicities` in interface `IMemoryView<T>`

    - #### removeOne

          default 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