public abstract class MaskedTupleMemory<Timestamp extends java.lang.Comparable<Timestamp>> extends java.lang.Object implements Clearable, MaskedResumable<Timestamp>
There are timeless and timely versions of the different memories. Timely versions associate Timeline
s with
the stored tuples.
Modifier and Type | Field and Description |
---|---|
protected TupleMask |
mask
The mask by which the tuples are indexed.
|
protected java.lang.Object |
owner
The object "owning" this memory.
|
Modifier | Constructor and Description |
---|---|
protected |
MaskedTupleMemory(TupleMask mask,
java.lang.Object owner) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Tuple tuple)
Adds a tuple occurrence to the memory.
|
boolean |
add(Tuple tuple,
Tuple signature)
Adds a tuple occurrence to the memory with the given signature.
|
Diff<Timestamp> |
addWithTimestamp(Tuple tuple,
Timestamp timestamp)
Adds a tuple occurrence to the memory with the given timestamp.
|
Diff<Timestamp> |
addWithTimestamp(Tuple tuple,
Tuple signature,
Timestamp timestamp)
Adds a tuple occurrence to the memory with the given signature and timestamp.
|
static <T extends java.lang.Comparable<T>> |
create(TupleMask mask,
CollectionsFactory.MemoryType bucketType,
java.lang.Object owner)
Creates a new memory for the given owner that indexes tuples according to the given mask.
|
static <T extends java.lang.Comparable<T>> |
create(TupleMask mask,
CollectionsFactory.MemoryType bucketType,
java.lang.Object owner,
boolean isTimely)
Creates a new memory for the given owner that indexes tuples according to the given mask.
|
static <T extends java.lang.Comparable<T>> |
create(TupleMask mask,
CollectionsFactory.MemoryType bucketType,
java.lang.Object owner,
boolean isTimely,
boolean isLazy)
Creates a new memory for the given owner that indexes tuples according to the given mask.
|
abstract java.util.Collection<Tuple> |
get(ITuple signature)
Retrieves tuples that have the specified signature
|
abstract int |
getKeysetSize() |
TupleMask |
getMask()
The mask according to which tuples are projected and indexed.
|
java.util.Collection<Tuple> |
getOrEmpty(ITuple signature)
Retrieves tuples that have the specified signature.
|
java.util.Map<Tuple,Timeline<Timestamp>> |
getOrEmptyWithTimeline(ITuple signature)
Retrieves tuples with their associated timelines that have the specified signature.
|
java.lang.Object |
getOwner()
The node owning this memory.
|
java.lang.Iterable<Tuple> |
getResumableSignatures()
Returns the set of signatures for which lazy folding shall be resumed at the next timestamp.
|
Timestamp |
getResumableTimestamp()
Returns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this
resumable.
|
abstract java.lang.Iterable<Tuple> |
getSignatures()
Retrieves a read-only view of exactly those signatures for which at least one tuple is stored
|
abstract int |
getTotalSize() |
abstract java.util.Map<Tuple,Timeline<Timestamp>> |
getWithTimeline(ITuple signature)
Retrieves the tuples and their associated timelines that have the specified signature.
|
void |
initializeWith(MaskedTupleMemory<Timestamp> other,
Timestamp defaultValue)
Initializes the contents of this memory based on the contents of another memory.
|
boolean |
isPresentAtInfinity(ITuple signature)
Returns true if there is any tuple with the given signature that is present at the timestamp +inf, false
otherwise.
|
boolean |
isTimely()
Returns true of this memory is timely, false otherwise.
|
abstract java.util.Iterator<Tuple> |
iterator()
Iterates over distinct tuples stored in the memory, regardless of their signatures.
|
protected java.lang.IllegalStateException |
raiseDuplicateDeletion(Tuple tuple) |
protected java.lang.IllegalStateException |
raiseDuplicateInsertion(Tuple tuple) |
boolean |
remove(Tuple tuple)
Removes a tuple occurrence from the memory.
|
boolean |
remove(Tuple tuple,
Tuple signature)
Removes a tuple occurrence from the memory with the given signature.
|
Diff<Timestamp> |
removeWithTimestamp(Tuple tuple,
Timestamp timestamp)
Removes a tuple occurrence from the memory with the given timestamp.
|
Diff<Timestamp> |
removeWithTimestamp(Tuple tuple,
Tuple signature,
Timestamp timestamp)
Removes a tuple occurrence from the memory with the given signature and timestamp.
|
java.util.Map<Tuple,java.util.Map<Tuple,Diff<Timestamp>>> |
resumeAt(Timestamp timestamp)
When called, the folding of the state shall be resumed at the given timestamp.
|
java.lang.String |
toString() |
protected final TupleMask mask
protected final java.lang.Object owner
protected MaskedTupleMemory(TupleMask mask, java.lang.Object owner)
public static <T extends java.lang.Comparable<T>> MaskedTupleMemory<T> create(TupleMask mask, CollectionsFactory.MemoryType bucketType, java.lang.Object owner)
public static <T extends java.lang.Comparable<T>> MaskedTupleMemory<T> create(TupleMask mask, CollectionsFactory.MemoryType bucketType, java.lang.Object owner, boolean isTimely)
public static <T extends java.lang.Comparable<T>> MaskedTupleMemory<T> create(TupleMask mask, CollectionsFactory.MemoryType bucketType, java.lang.Object owner, boolean isTimely, boolean isLazy)
public java.util.Map<Tuple,java.util.Map<Tuple,Diff<Timestamp>>> resumeAt(Timestamp timestamp)
MaskedResumable
resumeAt
in interface MaskedResumable<Timestamp extends java.lang.Comparable<Timestamp>>
public java.lang.Iterable<Tuple> getResumableSignatures()
MaskedResumable
getResumableSignatures
in interface MaskedResumable<Timestamp extends java.lang.Comparable<Timestamp>>
public Timestamp getResumableTimestamp()
Resumable
getResumableTimestamp
in interface Resumable<Timestamp extends java.lang.Comparable<Timestamp>>
public void initializeWith(MaskedTupleMemory<Timestamp> other, Timestamp defaultValue)
public boolean isPresentAtInfinity(ITuple signature)
public boolean isTimely()
public java.lang.Object getOwner()
public TupleMask getMask()
public abstract int getKeysetSize()
public abstract int getTotalSize()
This is currently not cached but computed on demand. It is therefore not efficient, and shall only be used for debug / profiling purposes.
public abstract java.util.Iterator<Tuple> iterator()
public abstract java.lang.Iterable<Tuple> getSignatures()
public abstract java.util.Collection<Tuple> get(ITuple signature)
public abstract java.util.Map<Tuple,Timeline<Timestamp>> getWithTimeline(ITuple signature)
public java.util.Collection<Tuple> getOrEmpty(ITuple signature)
public java.util.Map<Tuple,Timeline<Timestamp>> getOrEmptyWithTimeline(ITuple signature)
public boolean remove(Tuple tuple, Tuple signature)
tuple
- the tuple to be removed from the memorysignature
- precomputed footprint of the tuple according to the maskpublic Diff<Timestamp> removeWithTimestamp(Tuple tuple, Tuple signature, Timestamp timestamp)
tuple
- the tuple to be removed from the memorysignature
- precomputed footprint of the tuple according to the masktimestamp
- the timestamp associated with the tupleDiff
describing how the timeline of the given tuple changed.public boolean remove(Tuple tuple)
tuple
- the tuple to be removed from the memorypublic Diff<Timestamp> removeWithTimestamp(Tuple tuple, Timestamp timestamp)
tuple
- the tuple to be removed from the memorytimestamp
- the timestamp associated with the tupleDiff
describing how the timeline of the given tuple changed.public boolean add(Tuple tuple, Tuple signature)
tuple
- the tuple to be added to the memorysignature
- precomputed footprint of the tuple according to the maskpublic Diff<Timestamp> addWithTimestamp(Tuple tuple, Tuple signature, Timestamp timestamp)
tuple
- the tuple to be added to the memorysignature
- precomputed footprint of the tuple according to the masktimestamp
- the timestamp associated with the tupleDiff
describing how the timeline of the given tuple changed.public boolean add(Tuple tuple)
tuple
- the tuple to be added to the memorypublic Diff<Timestamp> addWithTimestamp(Tuple tuple, Timestamp timestamp)
tuple
- the tuple to be added to the memorytimestamp
- the timestamp associated with the tupleDiff
describing how the timeline of the given tuple changed.protected java.lang.IllegalStateException raiseDuplicateInsertion(Tuple tuple)
protected java.lang.IllegalStateException raiseDuplicateDeletion(Tuple tuple)
public java.lang.String toString()
toString
in class java.lang.Object