Class SingletonMemoryView<Value>
java.lang.Object
tools.refinery.interpreter.matchers.util.SingletonMemoryView<Value>
- All Implemented Interfaces:
Iterable<Value>
,IMemoryView<Value>
An immutable memory view that consists of a single non-null element with multiplicity 1.
- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsNonZero
(Value value) boolean
containsNonZeroUnsafe
(Object value) The set of distinct valuesboolean
int
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, entriesWithMultiplicities, forEachEntryWithMultiplicities, theContainedVersionOf, theContainedVersionOfUnsafe
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SingletonMemoryView
-
-
Method Details
-
iterator
-
getCount
Description copied from interface:IMemoryView
Returns the number of occurrences of the given value.- Specified by:
getCount
in interfaceIMemoryView<Value>
- 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<Value>
- Returns:
- the number of occurrences
-
containsNonZero
- Specified by:
containsNonZero
in interfaceIMemoryView<Value>
- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
- Specified by:
containsNonZeroUnsafe
in interfaceIMemoryView<Value>
- 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<Value>
- Returns:
- the number of distinct values
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIMemoryView<Value>
- 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<Value>
-
equals
-
hashCode
public int hashCode() -
toString
-