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

## Class EclipseCollectionsSetMemory<Value>

- java.lang.Object
- - org.eclipse.collections.impl.AbstractRichIterable<T>
  - - org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection<T>
    - - org.eclipse.collections.impl.set.AbstractUnifiedSet<T>
      - - org.eclipse.collections.impl.set.mutable.UnifiedSet<Value>
        - - org.eclipse.viatra.query.runtime.matchers.util.EclipseCollectionsSetMemory<Value>

- All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Value>, java.util.Collection<Value>, java.util.Set<Value>, org.eclipse.collections.api.collection.MutableCollection<Value>, org.eclipse.collections.api.InternalIterable<Value>, org.eclipse.collections.api.RichIterable<Value>, org.eclipse.collections.api.set.MutableSet<Value>, org.eclipse.collections.api.set.MutableSetIterable<Value>, org.eclipse.collections.api.set.Pool<Value>, org.eclipse.collections.api.set.SetIterable<Value>, org.eclipse.collections.api.set.UnsortedSetIterable<Value>, org.eclipse.collections.impl.parallel.BatchIterable<Value>, Clearable, IMemory<Value>, IMemoryView<Value>, ISetMemory<Value>

      public class EclipseCollectionsSetMemory<Value>
      extends org.eclipse.collections.impl.set.mutable.UnifiedSet<Value>
      implements ISetMemory<Value>

  Since:
    2.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.collections.impl.set.mutable.UnifiedSet

      `org.eclipse.collections.impl.set.mutable.UnifiedSet.PositionalIterator`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.collections.impl.set.mutable.UnifiedSet

      `NULL_KEY, occupied, table`

    - ### Fields inherited from class org.eclipse.collections.impl.set.AbstractUnifiedSet

      `DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, loadFactor, maxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EclipseCollectionsSetMemory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addOne(Value value)` Adds one value occurrence to the memory.
    `boolean` | `addSigned(Value value, int count)` Adds the given number of occurrences to the memory.
    `void` | `clearAllOf(Value value)` Removes all occurrences of the given value from the memory.
    `boolean` | `containsNonZero(Value value)`
    `boolean` | `containsNonZeroUnsafe(java.lang.Object value)`
    `java.util.Set<Value>` | `distinctValues()` The set of distinct values
    `boolean` | `equals(java.lang.Object obj)`
    `int` | `getCount(Value value)` Returns the number of occurrences of the given value.
    `int` | `getCountUnsafe(java.lang.Object value)` Returns the number of occurrences of the given value (which may be of any type).
    `int` | `hashCode()`
    `boolean` | `removeOne(Value value)` Removes one occurrence of the given value from the memory.
    `boolean` | `removeOneOrNop(Value value)` Removes one occurrence of the given value from the memory, if possible.
    `Value` | `theContainedVersionOf(Value value)` Where supported, returns the stored element that is equal to the given value, or null if none.
    `Value` | `theContainedVersionOfUnsafe(java.lang.Object value)` Where supported, returns the stored element that is equal to the given value (of any type), or null if none.

    - ### Methods inherited from class org.eclipse.collections.impl.set.mutable.UnifiedSet

      `add, addAllIterable, allocateTable, asParallel, batchForEach, clear, clone, contains, copySet, detect, detectOptional, each, each, forEachWith, forEachWithIndex, get, getFirst, getLast, getTable, groupBy, groupByEach, index, iterator, newEmpty, newEmpty, newSet, newSet, newSet, newSet, newSetWith, partition, partitionWith, put, readExternal, rehash, reject, rejectWith, remove, removeFromPool, retainAllIterable, select, selectAndRejectWith, selectInstancesOf, selectWith, shortCircuit, shortCircuitWith, size, tap, toArray, toArray, toImmutable, trimToSize, with, with, with, with, withAll, without, withoutAll, writeExternal`

    - ### Methods inherited from class org.eclipse.collections.impl.set.AbstractUnifiedSet

      `allocate, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asSynchronized, asUnmodifiable, cartesianProduct, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, computeMaxSize, detect, detectOptional, difference, differenceInto, flatCollect, getBatchCount, groupByUniqueKey, init, injectIntoWith, intersect, intersectInto, isProperSubsetOf, isSubsetOf, noneSatisfy, noneSatisfyWith, powerSet, rehash, removeAllIterable, retainAll, shortCircuit, symmetricDifference, symmetricDifferenceInto, union, unionInto, zip, zipWithIndex`

    - ### Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection

      `addAll, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, reduce, removeAll, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong`

    - ### Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable

      `appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, max, max, maxBy, min, min, minBy, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex`

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

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

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

      `forEachEntryWithMultiplicities`

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

      `clear`

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

      `asMap, asStream, entriesWithMultiplicities, equals, fromMap, hashCode, isEmpty, size`

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

      `forEach, iterator, spliterator`

    - ### Methods inherited from interface org.eclipse.collections.api.set.MutableSet

      `flatCollectWith`

    - ### Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection

      `aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong`

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

      `appendString, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByEach, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex`

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

      `forEach`

    - ### Methods inherited from interface java.util.Set

      `addAll, containsAll, isEmpty, removeAll, spliterator`

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

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface org.eclipse.collections.impl.parallel.BatchIterable

      `forEach`

- - ### Constructor Detail

    - #### EclipseCollectionsSetMemory

          public EclipseCollectionsSetMemory()

  - ### Method Detail

    - #### getCount

          public int getCount(Value value)

      Description copied from interface: `IMemoryView`
      Returns the number of occurrences of the given value.
      Specified by:
        `getCount` in interface `IMemoryView<Value>`
      Returns:
        the number of occurrences

    - #### getCountUnsafe

          public int getCountUnsafe(java.lang.Object value)

      Description copied from interface: `IMemoryView`
      Returns the number of occurrences of the given value (which may be of any type).
      Specified by:
        `getCountUnsafe` in interface `IMemoryView<Value>`
      Returns:
        the number of occurrences

    - #### containsNonZero

          public boolean containsNonZero(Value value)

      Specified by:
        `containsNonZero` in interface `IMemoryView<Value>`
      Returns:
        true if the given value is contained with a nonzero multiplicity

    - #### containsNonZeroUnsafe

          public boolean containsNonZeroUnsafe(java.lang.Object value)

      Specified by:
        `containsNonZeroUnsafe` in interface `IMemoryView<Value>`
      Returns:
        true if the given value (which may be of any type) is contained with a nonzero multiplicity

    - #### addOne

          public boolean addOne(Value value)

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

    - #### addSigned

          public boolean addSigned(Value 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<Value>`
        `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(Value 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<Value>`
      Specified by:
        `removeOne` in interface `ISetMemory<Value>`
      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(Value 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<Value>`
      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

    - #### clearAllOf

          public void clearAllOf(Value value)

      Description copied from interface: `IMemory`
      Removes all occurrences of the given value from the memory.
      Specified by:
        `clearAllOf` in interface `IMemory<Value>`

    - #### distinctValues

          public java.util.Set<Value> distinctValues()

      Description copied from interface: `IMemoryView`
      The set of distinct values
      Specified by:
        `distinctValues` in interface `IMemoryView<Value>`

    - #### theContainedVersionOf

          public Value theContainedVersionOf(Value value)

      Description copied from interface: `IMemoryView`
      Where supported, returns the stored element that is equal to the given value, or null if none. Useful for canonicalization in case of non-identity equals().

      For collections that do not support canonicalization, simply returns the argument if contained, null if none.

      Specified by:
        `theContainedVersionOf` in interface `IMemoryView<Value>`
      Returns:
        a value equal to the argument if such a value is stored, or null if none

    - #### theContainedVersionOfUnsafe

          public Value theContainedVersionOfUnsafe(java.lang.Object value)

      Description copied from interface: `IMemoryView`
      Where supported, returns the stored element that is equal to the given value (of any type), or null if none. Useful for canonicalization in case of non-identity equals().

      For collections that do not support canonicalization, simply returns the argument if contained, null if none.

      Specified by:
        `theContainedVersionOfUnsafe` in interface `IMemoryView<Value>`
      Returns:
        a value equal to the argument if such a value is stored, or null if none

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `java.util.Collection<Value>`
      Specified by:
        `hashCode` in interface `java.util.Set<Value>`
      Specified by:
        `hashCode` in interface `org.eclipse.collections.api.set.SetIterable<Value>`
      Overrides:
        `hashCode` in class `org.eclipse.collections.impl.set.mutable.UnifiedSet<Value>`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Specified by:
        `equals` in interface `java.util.Collection<Value>`
      Specified by:
        `equals` in interface `java.util.Set<Value>`
      Specified by:
        `equals` in interface `org.eclipse.collections.api.set.SetIterable<Value>`
      Overrides:
        `equals` in class `org.eclipse.collections.impl.set.mutable.UnifiedSet<Value>`