Class TimelyNullaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
java.lang.Object
tools.refinery.interpreter.matchers.memories.MaskedTupleMemory<Timestamp>
tools.refinery.interpreter.matchers.memories.timely.TimelyNullaryMaskedTupleMemory<Timestamp>
- All Implemented Interfaces:
Clearable,MaskedResumable<Timestamp>,Resumable<Timestamp>
public final class TimelyNullaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
extends MaskedTupleMemory<Timestamp>
Timely specialization for nullary mask.
- Since:
- 2.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Tupleprotected final TimelyMemory<Timestamp> Fields inherited from class tools.refinery.interpreter.matchers.memories.MaskedTupleMemory
mask, owner -
Constructor Summary
ConstructorsConstructorDescriptionTimelyNullaryMaskedTupleMemory(TupleMask mask, Object owner, boolean isLazy) -
Method Summary
Modifier and TypeMethodDescriptionaddWithTimestamp(Tuple tuple, Timestamp timestamp) Adds a tuple occurrence to the memory with the given timestamp.addWithTimestamp(Tuple tuple, Tuple signature, Timestamp timestamp) Adds a tuple occurrence to the memory with the given signature and timestamp.voidclear()Clear all partial matchings stored in memoryRetrieves tuples that have the specified signatureintReturns the set of signatures for which lazy folding shall be resumed at the next timestamp.Returns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.Retrieves a read-only view of exactly those signatures for which at least one tuple is storedintgetWithTimeline(ITuple signature) Retrieves the tuples and their associated timelines that have the specified signature.voidinitializeWith(MaskedTupleMemory<Timestamp> other, Timestamp defaultValue) Initializes the contents of this memory based on the contents of another memory.booleanisPresentAtInfinity(ITuple signature) Returns true if there is any tuple with the given signature that is present at the timestamp +inf, false otherwise.booleanisTimely()Returns true of this memory is timely, false otherwise.iterator()Iterates over distinct tuples stored in the memory, regardless of their signatures.removeWithTimestamp(Tuple tuple, Timestamp timestamp) Removes a tuple occurrence from the memory with the given timestamp.removeWithTimestamp(Tuple tuple, Tuple signature, Timestamp timestamp) Removes a tuple occurrence from the memory with the given signature and timestamp.When called, the folding of the state shall be resumed at the given timestamp.Methods inherited from class tools.refinery.interpreter.matchers.memories.MaskedTupleMemory
add, add, create, create, create, getMask, getOrEmpty, getOrEmptyWithTimeline, getOwner, raiseDuplicateDeletion, raiseDuplicateInsertion, remove, remove, toString
-
Field Details
-
EMPTY_TUPLE
-
UNIT_RELATION
-
EMPTY_RELATION
-
memory
-
-
Constructor Details
-
TimelyNullaryMaskedTupleMemory
-
-
Method Details
-
getKeysetSize
public int getKeysetSize()- Specified by:
getKeysetSizein classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Returns:
- the number of distinct signatures of all stored tuples.
-
getSignatures
Description copied from class:MaskedTupleMemoryRetrieves a read-only view of exactly those signatures for which at least one tuple is stored- Specified by:
getSignaturesin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
get
Description copied from class:MaskedTupleMemoryRetrieves tuples that have the specified signature- Specified by:
getin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Returns:
- collection of tuples found, null if none
-
getWithTimeline
Description copied from class:MaskedTupleMemoryRetrieves the tuples and their associated timelines that have the specified signature.- Specified by:
getWithTimelinein classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Returns:
- the mappings from tuples to timelines, null if there is no mapping for the signature
-
removeWithTimestamp
Description copied from class:MaskedTupleMemoryRemoves a tuple occurrence from the memory with the given signature and timestamp.- Overrides:
removeWithTimestampin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Parameters:
tuple- the tuple to be removed from the memorysignature- precomputed footprint of the tuple according to the masktimestamp- the timestamp associated with the tuple- Returns:
- A
Diffdescribing how the timeline of the given tuple changed.
-
addWithTimestamp
Description copied from class:MaskedTupleMemoryAdds a tuple occurrence to the memory with the given signature and timestamp.- Overrides:
addWithTimestampin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Parameters:
tuple- the tuple to be added to the memorysignature- precomputed footprint of the tuple according to the masktimestamp- the timestamp associated with the tuple- Returns:
- A
Diffdescribing how the timeline of the given tuple changed.
-
isPresentAtInfinity
Description copied from class:MaskedTupleMemoryReturns true if there is any tuple with the given signature that is present at the timestamp +inf, false otherwise.- Overrides:
isPresentAtInfinityin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
getResumableSignatures
Description copied from interface:MaskedResumableReturns the set of signatures for which lazy folding shall be resumed at the next timestamp.- Specified by:
getResumableSignaturesin interfaceMaskedResumable<Timestamp extends Comparable<Timestamp>>- Overrides:
getResumableSignaturesin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
resumeAt
Description copied from interface:MaskedResumableWhen called, the folding of the state shall be resumed at the given timestamp. The resumable is expected to do a folding step at the given timestamp only. Afterwards, folding shall be interrupted, even if there is more folding to do towards higher timestamps.- Specified by:
resumeAtin interfaceMaskedResumable<Timestamp extends Comparable<Timestamp>>- Overrides:
resumeAtin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
initializeWith
Description copied from class:MaskedTupleMemoryInitializes the contents of this memory based on the contents of another memory. The default value is associated with each tuple in the timely memories.- Overrides:
initializeWithin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
clear
public void clear()Description copied from interface:ClearableClear all partial matchings stored in memory -
getTotalSize
public int getTotalSize()- Specified by:
getTotalSizein 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.
-
iterator
Description copied from class:MaskedTupleMemoryIterates over distinct tuples stored in the memory, regardless of their signatures.- Specified by:
iteratorin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
removeWithTimestamp
Description copied from class:MaskedTupleMemoryRemoves a tuple occurrence from the memory with the given timestamp.- Overrides:
removeWithTimestampin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Parameters:
tuple- the tuple to be removed from the memorytimestamp- the timestamp associated with the tuple- Returns:
- A
Diffdescribing how the timeline of the given tuple changed.
-
addWithTimestamp
Description copied from class:MaskedTupleMemoryAdds a tuple occurrence to the memory with the given timestamp.- Overrides:
addWithTimestampin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>- Parameters:
tuple- the tuple to be added to the memorytimestamp- the timestamp associated with the tuple- Returns:
- A
Diffdescribing how the timeline of the given tuple changed.
-
isTimely
public boolean isTimely()Description copied from class:MaskedTupleMemoryReturns true of this memory is timely, false otherwise.- Overrides:
isTimelyin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-
getResumableTimestamp
Description copied from interface:ResumableReturns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.- Specified by:
getResumableTimestampin interfaceResumable<Timestamp extends Comparable<Timestamp>>- Overrides:
getResumableTimestampin classMaskedTupleMemory<Timestamp extends Comparable<Timestamp>>
-