Class EmptyMemory<T>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.matchers.util.EmptyMemory<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>
,IMemoryView<T>
public class EmptyMemory<T> extends java.lang.Object implements IMemoryView<T>
A singleton immutable empty memory.- Since:
- 2.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsNonZero(T value)
boolean
containsNonZeroUnsafe(java.lang.Object value)
java.util.Set<T>
distinctValues()
The set of distinct valuesboolean
equals(java.lang.Object obj)
int
getCount(T value)
Returns the number of occurrences of the given value.int
getCountUnsafe(java.lang.Object value)
Returns the number of occurrences of the given value (which may be of any type).int
hashCode()
static <T> EmptyMemory<T>
instance()
boolean
isEmpty()
java.util.Iterator<T>
iterator()
int
size()
java.lang.String
toString()
-
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
-
-
-
-
Method Detail
-
instance
public static <T> EmptyMemory<T> instance()
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
getCount
public int getCount(T value)
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
public int getCountUnsafe(java.lang.Object value)
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
public boolean containsNonZero(T value)
- Specified by:
containsNonZero
in interfaceIMemoryView<T>
- Returns:
- true if the given value is contained with a nonzero multiplicity
-
containsNonZeroUnsafe
public boolean containsNonZeroUnsafe(java.lang.Object value)
- 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
public java.util.Set<T> distinctValues()
Description copied from interface:IMemoryView
The set of distinct values- Specified by:
distinctValues
in interfaceIMemoryView<T>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-