public abstract class MaskedTupleMemory<Timestamp extends java.lang.Comparable<Timestamp>> extends java.lang.Object implements Clearable
There are timeless and timely versions of the different memories. Timely versions associate timestamps with the stored tuples. A tuple with the same timestamp can be inserted multiple times to the timely memories. These memories can efficiently answer queries about the least timestamp associated with a tuple, and they can also enumerate all timestamps associated with given tuple(s).
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.
|
TimestampReplacement<Timestamp> |
addWithTimestamp(Tuple tuple,
Timestamp timestamp)
Adds a tuple occurrence to the memory with the given timestamp.
|
TimestampReplacement<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.
|
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,Timestamp> |
getOrEmptyWithTimestamp(ITuple signature) |
java.lang.Object |
getOwner()
The node owning this memory.
|
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,Timestamp> |
getWithTimestamp(ITuple signature)
Retrieves the tuples and their associated timestamps 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 |
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.
|
TimestampReplacement<Timestamp> |
removeWithTimestamp(Tuple tuple,
Timestamp timestamp)
Removes a tuple occurrence from the memory with the given timestamp.
|
TimestampReplacement<Timestamp> |
removeWithTimestamp(Tuple tuple,
Tuple signature,
Timestamp timestamp)
Removes a tuple occurrence from the memory with the given signature and timestamp.
|
java.lang.String |
toString() |
protected TupleMask mask
protected 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 void initializeWith(MaskedTupleMemory<Timestamp> other, Timestamp defaultValue)
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,Timestamp> getWithTimestamp(ITuple signature)
public java.util.Collection<Tuple> getOrEmpty(ITuple signature)
public java.util.Map<Tuple,Timestamp> getOrEmptyWithTimestamp(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 TimestampReplacement<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 tuplepublic boolean remove(Tuple tuple)
tuple
- the tuple to be removed from the memorypublic TimestampReplacement<Timestamp> removeWithTimestamp(Tuple tuple, Timestamp timestamp)
tuple
- the tuple to be removed from the memorytimestamp
- the timestamp associated with the tuplepublic boolean add(Tuple tuple, Tuple signature)
tuple
- the tuple to be added to the memorysignature
- precomputed footprint of the tuple according to the maskpublic TimestampReplacement<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 tuplepublic boolean add(Tuple tuple)
tuple
- the tuple to be added to the memorypublic TimestampReplacement<Timestamp> addWithTimestamp(Tuple tuple, Timestamp timestamp)
tuple
- the tuple to be added to the memorytimestamp
- the timestamp associated with the tupleprotected java.lang.IllegalStateException raiseDuplicateInsertion(Tuple tuple)
protected java.lang.IllegalStateException raiseDuplicateDeletion(Tuple tuple)
public java.lang.String toString()
toString
in class java.lang.Object