Class MapBackedMemoryView<T>
java.lang.Object
tools.refinery.interpreter.matchers.util.MapBackedMemoryView<T>
- All Implemented Interfaces:
Iterable<T>,IMemoryView<T>
Wraps a Mapinvalid input: '<'T, Integer> (mapping elements to non-zero multiplicities) into an
IMemoryView.- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsNonZero(T value) booleancontainsNonZeroUnsafe(Object value) The set of distinct valuesbooleanvoidforEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) Process contained values with their multiplicitiesintReturns the number of occurrences of the given value.intgetCountUnsafe(Object value) Returns the number of occurrences of the given value (which may be of any type).inthashCode()booleanisEmpty()iterator()intsize()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface tools.refinery.interpreter.matchers.util.IMemoryView
asMap, asStream, theContainedVersionOf, theContainedVersionOfUnsafeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MapBackedMemoryView
- Parameters:
wrapped- an equivalent map from contained objects to multiplicities
-
-
Method Details
-
iterator
-
getCount
Description copied from interface:IMemoryViewReturns the number of occurrences of the given value.- Specified by:
getCountin interfaceIMemoryView<T>- Returns:
- the number of occurrences
-
getCountUnsafe
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
- Specified by:
containsNonZeroin interfaceIMemoryView<T>- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
- Specified by:
containsNonZeroUnsafein interfaceIMemoryView<T>- Returns:
- true if the given value (which may be of any type) is contained with a nonzero multiplicity
-
size
public int size()- Specified by:
sizein interfaceIMemoryView<T>- Returns:
- the number of distinct values
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIMemoryView<T>- Returns:
- iff contains at least one value with non-zero occurrences
-
distinctValues
Description copied from interface:IMemoryViewThe set of distinct values- Specified by:
distinctValuesin interfaceIMemoryView<T>
-
forEachEntryWithMultiplicities
Description copied from interface:IMemoryViewProcess contained values with their multiplicities- Specified by:
forEachEntryWithMultiplicitiesin interfaceIMemoryView<T>
-
entriesWithMultiplicities
- Specified by:
entriesWithMultiplicitiesin interfaceIMemoryView<T>- Returns:
- an unmodifiable view of contained values with their multiplicities
-
hashCode
public int hashCode() -
equals
-
toString
-