Class EclipseCollectionsBagMemory<T>
- java.lang.Object
-
- org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
-
- org.eclipse.viatra.query.runtime.matchers.util.EclipseCollectionsBagMemory<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>
- 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:
- Serialized Form
- No Reference:
-
-
Constructor Summary
Constructors Constructor Description EclipseCollectionsBagMemory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAllOf(T value)Removes all occurrences of the given value from the memory.booleancontainsNonZero(T value)booleancontainsNonZeroUnsafe(java.lang.Object value)java.util.Set<T>distinctValues()The set of distinct valuesbooleanequals(java.lang.Object obj)voidforEachEntryWithMultiplicities(java.util.function.BiConsumer<T,java.lang.Integer> entryConsumer)Process contained values with their multiplicitiesintgetCount(T value)Returns the number of occurrences of the given value.intgetCountUnsafe(java.lang.Object value)Returns the number of occurrences of the given value (which may be of any type).inthashCode()java.util.Iterator<T>iterator()java.lang.StringtoString()-
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, 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
addOne, addSigned, clear, removeOne, removeOneOrNop
-
Methods inherited from interface org.eclipse.viatra.query.runtime.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, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy
-
-
-
-
Method Detail
-
getCount
public int getCount(T value)
Description copied from interface:IMemoryViewReturns the number of occurrences of the given value.- Specified by:
getCountin interfaceIMemoryView<T>- Returns:
- the number of occurrences
-
getCountUnsafe
public int getCountUnsafe(java.lang.Object value)
Description copied from interface:IMemoryViewReturns the number of occurrences of the given value (which may be of any type).- Specified by:
getCountUnsafein interfaceIMemoryView<T>- Returns:
- the number of occurrences
-
containsNonZero
public boolean containsNonZero(T value)
- Specified by:
containsNonZeroin interfaceIMemoryView<T>- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
public boolean containsNonZeroUnsafe(java.lang.Object value)
- Specified by:
containsNonZeroUnsafein interfaceIMemoryView<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:IMemoryRemoves all occurrences of the given value from the memory.- Specified by:
clearAllOfin interfaceIMemory<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>
-
toString
public java.lang.String toString()
-
distinctValues
public java.util.Set<T> distinctValues()
Description copied from interface:IMemoryViewThe set of distinct values- Specified by:
distinctValuesin interfaceIMemoryView<T>
-
forEachEntryWithMultiplicities
public void forEachEntryWithMultiplicities(java.util.function.BiConsumer<T,java.lang.Integer> entryConsumer)
Description copied from interface:IMemoryViewProcess contained values with their multiplicities- Specified by:
forEachEntryWithMultiplicitiesin interfaceIMemoryView<T>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classorg.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classorg.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap<T>
-
-