Interface IMultiLookupAbstract.ToSetsAbstract<Key,Value>
- All Superinterfaces:
IMultiLookup<Key,
,Value> IMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>>
- Enclosing interface:
IMultiLookupAbstract<Key,
Value, Bucket extends MarkedMemory<Value>>
public static interface IMultiLookupAbstract.ToSetsAbstract<Key,Value>
extends IMultiLookupAbstract<Key,Value,MarkedMemory.MarkedSet<Value>>
A multi-lookup whose buckets are sets.
Not intended as an API, but rather as a 'base class' for implementors. Realized as an interface with default implementations, instead of an abstract class, to ensure that implementors can easily choose a base class such as UnifiedMap to augment.
Implementor should inherit from a Mapinvalid input: '<'Key, Object>-like class (primitive map possible) and bind the lowLevel* methods accordingly.
-
Nested Class Summary
Nested classes/interfaces inherited from interface tools.refinery.interpreter.matchers.util.IMultiLookup
IMultiLookup.ChangeGranularity
Nested classes/interfaces inherited from interface tools.refinery.interpreter.matchers.util.IMultiLookupAbstract
IMultiLookupAbstract.ToMultisetsAbstract<Key,
Value>, IMultiLookupAbstract.ToSetsAbstract<Key, Value> -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
addToBucket
(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) Increases the multiplicity of the value in the bucket.default Value
asSingleton
(MarkedMemory.MarkedSet<Value> bucket) Checks whether the bucket is a singleton, i.e.default MarkedMemory.MarkedSet
<Value> createDeltaBucket
(Value positive, Value negative) default MarkedMemory.MarkedSet
<Value> createSingletonBucket
(Value value) default boolean
default boolean
default boolean
removeFromBucket
(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) Decreases the multiplicity of the value in the bucket.Methods inherited from interface tools.refinery.interpreter.matchers.util.IMultiLookup
clear, isEmpty, lookupOrEmpty, lookupUnsafeOrEmpty
Methods inherited from interface tools.refinery.interpreter.matchers.util.IMultiLookupAbstract
addPair, addPairInternal, addPairOrNop, addPairPositiveMultiplicity, countKeys, distinctKeys, distinctKeysStream, distinctValues, distinctValuesStream, handleSingleton, lookup, lookupAndRemoveAll, lookupExists, lookupUnsafe, lowLevelGet, lowLevelGetUnsafe, lowLevelKeySet, lowLevelPut, lowLevelPutIfAbsent, lowLevelRemove, lowLevelSize, lowLevelValues, removePair, removePairInternal, removePairOrNop, yieldSingleton
-
Method Details
-
createMarkedSet
MarkedMemory.MarkedSet<Value> createMarkedSet()- Returns:
- a fresh, empty marked set
-
negativesAllowed
default boolean negativesAllowed()- Specified by:
negativesAllowed
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- iff negative multiplicites are allowed
-
duplicatesAllowed
default boolean duplicatesAllowed()- Specified by:
duplicatesAllowed
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- iff larger-than-1 multiplicites are allowed
-
addToBucket
default boolean addToBucket(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) Description copied from interface:IMultiLookupAbstract
Increases the multiplicity of the value in the bucket.- Specified by:
addToBucket
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- true iff non-duplicate
-
removeFromBucket
default boolean removeFromBucket(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) Description copied from interface:IMultiLookupAbstract
Decreases the multiplicity of the value in the bucket.- Specified by:
removeFromBucket
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- false if removing duplicate value
-
asSingleton
Description copied from interface:IMultiLookupAbstract
Checks whether the bucket is a singleton, i.e. it contains a single value with multiplicity +1- Specified by:
asSingleton
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- the singleton value, or null if the bucket is not singleton
-
createSingletonBucket
- Specified by:
createSingletonBucket
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Returns:
- a new bucket consisting of a sole value
-
createDeltaBucket
- Specified by:
createDeltaBucket
in interfaceIMultiLookupAbstract<Key,
Value, MarkedMemory.MarkedSet<Value>> - Parameters:
positive
- the previously existing value, or null if the delta is to contain a single negative tuple- Returns:
- a new bucket consisting of a delta of two values
-