- Type Parameters:
T- the type of facts that this storage system handles
- All Superinterfaces:
Iterable<FactStorage.Entry<T>>,ReIterable<FactStorage.Entry<T>>
Represents a storage system for facts, allowing for operations such as insertion, deletion, updating, and retrieval of facts.
This storage system essentially acts as a mapping between fact handles (unique identifiers for facts) and the facts themselves.
The engine creates a
FactStorage instance for each declared fact of a specific Type.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents an entry in the storage, holding both a fact handle and the fact instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all facts from the storage.voiddelete(FactHandle handle) Deletes a fact from the storage, identified by the provided handle.getFact(FactHandle handle) Retrieves the fact associated with the provided handle.Creates and returns new FactHandle for each inserted fact.voidupdate(FactHandle handle, T newInstance) Updates an existing fact in the storage with a new instance, identified by the provided handle.Methods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.evrete.api.ReIterable
iterator, iterator
-
Method Details
-
insert
Creates and returns new FactHandle for each inserted fact. The contract is that the implementation must return
nullif object is already known and not deleted.- Parameters:
fact- the fact being inserted in the working memory- Returns:
- null if object has been already inserted or a new FactHandle otherwise
-
delete
Deletes a fact from the storage, identified by the provided handle.- Parameters:
handle- the handle of the fact to be deleted
-
update
Updates an existing fact in the storage with a new instance, identified by the provided handle.- Parameters:
handle- the handle of the fact to be updatednewInstance- the new instance to replace the existing fact
-
getFact
Retrieves the fact associated with the provided handle.- Parameters:
handle- the handle whose associated fact is to be retrieved- Returns:
- the fact associated with the provided handle
-
clear
void clear()Clears all facts from the storage.
-