- Type Parameters:
V- the value type
- All Superinterfaces:
DeltaInsertMemory,ReteMemory<Long>
- All Known Implementing Classes:
GroupingReteMemoryWrapper
A map-like storage that holds objects grouped by keys, similar to
Map<Long, Set<V>>. Internally, the memory is split into two parts:
a main memory and a delta memory for buffering insertions. Upon calling the DeltaInsertMemory.commit() method,
the implementation empties the delta memory by moving all the data into the main memory.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes the given key and value from both delta and main memories.voidBuffers a new key/value combination into the delta memory.keyIterator(MemoryScope scope) stream(MemoryScope scope, long key) Provides a default implementation for streaming over stored elements based on the provided key and scope.valueIterator(MemoryScope scope, long key) Returns an iterator over values.Methods inherited from interface org.evrete.api.spi.DeltaInsertMemory
clear, commit, commitMethods inherited from interface org.evrete.api.ReteMemory
iterator, stream
-
Method Details
-
insert
Buffers a new key/value combination into the delta memory.- Parameters:
key- the key to be insertedvalue- the value associated with the key- Throws:
NullPointerException- if the key or value is null
-
delete
Deletes the given key and value from both delta and main memories. If the value is the last one stored under this key, the key must be deleted as well.- Parameters:
key- the key to be deletedvalue- the value associated with the key- Throws:
NullPointerException- if the key or value is null
-
valueIterator
Returns an iterator over values.- Parameters:
scope- the scope of the values (not the keys)key- the key identifying the values to iterate over- Returns:
- an iterator over the values associated with the given key in the specified scope
-
stream
Provides a default implementation for streaming over stored elements based on the provided key and scope. Implementations are encouraged to override this method to create parallel streams, if possible.- Parameters:
scope- The memory scope indicating whether to stream over main or delta storage.key- The key identifying the collection of values to stream.- Returns:
- A stream over elements in the storage of the provided scope.
-
keyIterator
-