Class DefaultMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
java.lang.Object
tools.refinery.interpreter.matchers.memories.MaskedTupleMemory<Timestamp>
tools.refinery.interpreter.matchers.memories.DefaultMaskedTupleMemory<Timestamp>
- All Implemented Interfaces:
Clearable
,MaskedResumable<Timestamp>
,Resumable<Timestamp>
public final class DefaultMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
extends MaskedTupleMemory<Timestamp>
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IMultiLookup
<Tuple, Tuple> Maps a signature tuple to the bucket of tuples with the given signature.Fields inherited from class tools.refinery.interpreter.matchers.memories.MaskedTupleMemory
mask, owner
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMaskedTupleMemory
(TupleMask mask, CollectionsFactory.MemoryType bucketType, Object owner) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a tuple occurrence to the memory.boolean
Adds a tuple occurrence to the memory with the given signature.void
clear()
Clear all partial matchings stored in memoryRetrieves tuples that have the specified signatureint
Retrieves a read-only view of exactly those signatures for which at least one tuple is storedint
getWithTimeline
(ITuple signature) Retrieves the tuples and their associated timelines that have the specified signature.iterator()
Iterates over distinct tuples stored in the memory, regardless of their signatures.boolean
Removes a tuple occurrence from the memory.boolean
Removes a tuple occurrence from the memory with the given signature.Methods inherited from class tools.refinery.interpreter.matchers.memories.MaskedTupleMemory
addWithTimestamp, addWithTimestamp, create, create, create, getMask, getOrEmpty, getOrEmptyWithTimeline, getOwner, getResumableSignatures, getResumableTimestamp, initializeWith, isPresentAtInfinity, isTimely, raiseDuplicateDeletion, raiseDuplicateInsertion, removeWithTimestamp, removeWithTimestamp, resumeAt, toString
-
Field Details
-
signatureToTuples
Maps a signature tuple to the bucket of tuples with the given signature.- Since:
- 2.0
-
-
Constructor Details
-
DefaultMaskedTupleMemory
public DefaultMaskedTupleMemory(TupleMask mask, CollectionsFactory.MemoryType bucketType, Object owner) - Parameters:
mask
- The mask used to index the matchingsbucketType
- the kind of tuple collection maintained for each indexer bucketowner
- the object "owning" this memory- Since:
- 2.0
-
-
Method Details
-
add
Description copied from class:MaskedTupleMemory
Adds a tuple occurrence to the memory.- Overrides:
add
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Parameters:
tuple
- the tuple to be added to the memory- Returns:
- true if new signature encountered (according to the mask)
-
add
Description copied from class:MaskedTupleMemory
Adds a tuple occurrence to the memory with the given signature.- Overrides:
add
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Parameters:
tuple
- the tuple to be added to the memorysignature
- precomputed footprint of the tuple according to the mask- Returns:
- true if new signature encountered (according to the mask)
-
remove
Description copied from class:MaskedTupleMemory
Removes a tuple occurrence from the memory.- Overrides:
remove
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Parameters:
tuple
- the tuple to be removed from the memory- Returns:
- true if this was the the last occurrence of the signature (according to the mask)
-
remove
Description copied from class:MaskedTupleMemory
Removes a tuple occurrence from the memory with the given signature.- Overrides:
remove
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Parameters:
tuple
- the tuple to be removed from the memorysignature
- precomputed footprint of the tuple according to the mask- Returns:
- true if this was the the last occurrence of the signature (according to the mask)
-
getWithTimeline
Description copied from class:MaskedTupleMemory
Retrieves the tuples and their associated timelines that have the specified signature.- Specified by:
getWithTimeline
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Returns:
- the mappings from tuples to timelines, null if there is no mapping for the signature
-
get
Description copied from class:MaskedTupleMemory
Retrieves tuples that have the specified signature- Specified by:
get
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Returns:
- collection of tuples found, null if none
-
clear
public void clear()Description copied from interface:Clearable
Clear all partial matchings stored in memory -
getSignatures
Description copied from class:MaskedTupleMemory
Retrieves a read-only view of exactly those signatures for which at least one tuple is stored- Specified by:
getSignatures
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
iterator
Description copied from class:MaskedTupleMemory
Iterates over distinct tuples stored in the memory, regardless of their signatures.- Specified by:
iterator
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
getTotalSize
public int getTotalSize()- Specified by:
getTotalSize
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Returns:
- the total number of distinct tuples stored. Multiple copies of the same tuple, if allowed, are counted as
one.
This is currently not cached but computed on demand. It is therefore not efficient, and shall only be used for debug / profiling purposes.
-
getKeysetSize
public int getKeysetSize()- Specified by:
getKeysetSize
in classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
- Returns:
- the number of distinct signatures of all stored tuples.
-