Class EclipseCollectionsSetMemory<Value>

java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<Value>
org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection<Value>
org.eclipse.collections.impl.set.AbstractUnifiedSet<Value>
org.eclipse.collections.impl.set.mutable.UnifiedSet<Value>
tools.refinery.interpreter.matchers.util.EclipseCollectionsSetMemory<Value>
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Iterable<Value>, Collection<Value>, 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:
  • 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
    Description
     
  • Method Summary

    Modifier and Type
    Method
    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
    Removes all occurrences of the given value from the memory.
    boolean
     
    boolean
     
    The set of distinct values
    boolean
     
    int
    getCount(Value value)
    Returns the number of occurrences of the given value.
    int
    Returns the number of occurrences of the given value (which may be of any type).
    int
     
    boolean
    Removes one occurrence of the given value from the memory.
    boolean
    Removes one occurrence of the given value from the memory, if possible.
    Where supported, returns the stored element that is equal to the given value, or null if none.
    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, collectIf, 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, countBy, countByEach, countByWith, reduce, removeAll, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong

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

    appendString, appendString, asLazy, collect, collectIf, 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.collections.impl.parallel.BatchIterable

    forEach

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface tools.refinery.interpreter.matchers.util.IMemory

    clear

    Methods inherited from interface tools.refinery.interpreter.matchers.util.IMemoryView

    asMap, asStream, entriesWithMultiplicities, isEmpty, size

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

    forEach

    Methods inherited from interface tools.refinery.interpreter.matchers.util.ISetMemory

    forEachEntryWithMultiplicities

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

    aggregateBy, aggregateInPlaceBy, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, countBy, countByEach, countByWith, flatCollectWith, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong

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

    collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, flatCollectWith, toImmutableSet

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

    aggregateBy, appendString, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, 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, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex

    Methods inherited from interface java.util.Set

    addAll, containsAll, isEmpty, removeAll, spliterator
  • Constructor Details

    • EclipseCollectionsSetMemory

      public EclipseCollectionsSetMemory()
  • Method Details

    • 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(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(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>
      Parameters:
      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 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(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 Collection<Value>
      Specified by:
      hashCode in interface 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(Object obj)
      Specified by:
      equals in interface Collection<Value>
      Specified by:
      equals in interface 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>