Class EclipseCollectionsBagMemory<T>

java.lang.Object
org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
tools.refinery.interpreter.matchers.util.EclipseCollectionsBagMemory<T>
All Implemented Interfaces:
Externalizable, Serializable, 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>
Direct Known Subclasses:
EclipseCollectionsDeltaBag, EclipseCollectionsMultiset

public abstract class EclipseCollectionsBagMemory<T> extends org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T> implements IMemory<T>
Eclipse Collections-based multiset for tuples. Can contain duplicate occurrences of the same matching.

Inherits Eclipse Collections' Object-to-Int primitive hashmap and counts the number of occurrences of each value. Element is deleted if # of occurences drops to 0.

Since:
1.7
See Also:
  • Field Summary

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

    EMPTY_VALUE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clearAllOf(T value)
    Removes all occurrences of the given value from the memory.
    boolean
     
    boolean
     
    The set of distinct values
    boolean
     
    void
    Process contained values with their multiplicities
    int
    getCount(T 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
     
     
     

    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, forEachKey, forEachKeyValue, forEachValue, get, getAndPut, 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, 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 tools.refinery.interpreter.matchers.util.IMemory

    addOne, addSigned, clear, removeOne, removeOneOrNop

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

    asMap, asStream, entriesWithMultiplicities, isEmpty, size, theContainedVersionOf, theContainedVersionOfUnsafe

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

    averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

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

    putPair, tap, withAllKeyValues

    Methods inherited from interface org.eclipse.collections.api.map.primitive.ObjectIntMap

    injectIntoKeyValue
  • Constructor Details

    • EclipseCollectionsBagMemory

      public EclipseCollectionsBagMemory()
  • Method Details

    • getCount

      public int getCount(T value)
      Description copied from interface: IMemoryView
      Returns the number of occurrences of the given value.
      Specified by:
      getCount in interface IMemoryView<T>
      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<T>
      Returns:
      the number of occurrences
    • containsNonZero

      public boolean containsNonZero(T value)
      Specified by:
      containsNonZero in interface IMemoryView<T>
      Returns:
      true if the given value is contained with a nonzero multiplicity
    • containsNonZeroUnsafe

      public boolean containsNonZeroUnsafe(Object value)
      Specified by:
      containsNonZeroUnsafe in interface IMemoryView<T>
      Returns:
      true if the given value (which may be of any type) is contained with a nonzero multiplicity
    • clearAllOf

      public void clearAllOf(T value)
      Description copied from interface: IMemory
      Removes all occurrences of the given value from the memory.
      Specified by:
      clearAllOf in interface IMemory<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • toString

      public String toString()
      Specified by:
      toString in interface org.eclipse.collections.api.map.primitive.ObjectIntMap<T>
      Specified by:
      toString in interface org.eclipse.collections.api.PrimitiveIterable
      Overrides:
      toString in class org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
    • distinctValues

      public Set<T> distinctValues()
      Description copied from interface: IMemoryView
      The set of distinct values
      Specified by:
      distinctValues in interface IMemoryView<T>
    • forEachEntryWithMultiplicities

      public void forEachEntryWithMultiplicities(BiConsumer<T,Integer> entryConsumer)
      Description copied from interface: IMemoryView
      Process contained values with their multiplicities
      Specified by:
      forEachEntryWithMultiplicities in interface IMemoryView<T>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>