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 TypeMethodDescriptionboolean
containsNonZero
(T value) boolean
containsNonZeroUnsafe
(Object value) The set of distinct valuesboolean
void
forEachEntryWithMultiplicities
(BiConsumer<T, Integer> entryConsumer) Process contained values with their multiplicitiesint
Returns the number of occurrences of the given value.int
getCountUnsafe
(Object value) Returns the number of occurrences of the given value (which may be of any type).int
hashCode()
boolean
isEmpty()
iterator()
int
size()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface tools.refinery.interpreter.matchers.util.IMemoryView
asMap, asStream, theContainedVersionOf, theContainedVersionOfUnsafe
Methods 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:IMemoryView
Returns the number of occurrences of the given value.- Specified by:
getCount
in interfaceIMemoryView<T>
- Returns:
- the number of occurrences
-
getCountUnsafe
Description copied from interface:IMemoryView
Returns the number of occurrences of the given value (which may be of any type).- Specified by:
getCountUnsafe
in interfaceIMemoryView<T>
- Returns:
- the number of occurrences
-
containsNonZero
- Specified by:
containsNonZero
in interfaceIMemoryView<T>
- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
- Specified by:
containsNonZeroUnsafe
in 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:
size
in interfaceIMemoryView<T>
- Returns:
- the number of distinct values
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIMemoryView<T>
- Returns:
- iff contains at least one value with non-zero occurrences
-
distinctValues
Description copied from interface:IMemoryView
The set of distinct values- Specified by:
distinctValues
in interfaceIMemoryView<T>
-
forEachEntryWithMultiplicities
Description copied from interface:IMemoryView
Process contained values with their multiplicities- Specified by:
forEachEntryWithMultiplicities
in interfaceIMemoryView<T>
-
entriesWithMultiplicities
- Specified by:
entriesWithMultiplicities
in interfaceIMemoryView<T>
- Returns:
- an unmodifiable view of contained values with their multiplicities
-
hashCode
public int hashCode() -
equals
-
toString
-