Class SingletonMemoryView<Value>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.matchers.util.SingletonMemoryView<Value>
-
- All Implemented Interfaces:
java.lang.Iterable<Value>,IMemoryView<Value>
public final class SingletonMemoryView<Value> extends java.lang.Object implements IMemoryView<Value>
An immutable memory view that consists of a single non-null element with multiplicity 1.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description SingletonMemoryView(Value value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsNonZero(Value value)booleancontainsNonZeroUnsafe(java.lang.Object value)java.util.Set<Value>distinctValues()The set of distinct valuesbooleanequals(java.lang.Object obj)intgetCount(Value 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()booleanisEmpty()java.util.Iterator<Value>iterator()intsize()java.lang.StringtoString()-
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.IMemoryView
asMap, asStream, entriesWithMultiplicities, forEachEntryWithMultiplicities, theContainedVersionOf, theContainedVersionOfUnsafe
-
-
-
-
Constructor Detail
-
SingletonMemoryView
public SingletonMemoryView(Value value)
-
-
Method Detail
-
iterator
public java.util.Iterator<Value> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Value>
-
getCount
public int getCount(Value value)
Description copied from interface:IMemoryViewReturns the number of occurrences of the given value.- Specified by:
getCountin interfaceIMemoryView<Value>- 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<Value>- Returns:
- the number of occurrences
-
containsNonZero
public boolean containsNonZero(Value value)
- Specified by:
containsNonZeroin interfaceIMemoryView<Value>- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
public boolean containsNonZeroUnsafe(java.lang.Object value)
- Specified by:
containsNonZeroUnsafein 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:
sizein interfaceIMemoryView<Value>- Returns:
- the number of distinct values
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceIMemoryView<Value>- Returns:
- iff contains at least one value with non-zero occurrences
-
distinctValues
public java.util.Set<Value> distinctValues()
Description copied from interface:IMemoryViewThe set of distinct values- Specified by:
distinctValuesin interfaceIMemoryView<Value>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-