public interface StatefulSession extends RuleSession<StatefulSession>, AutoCloseable
SALIENCE_COMPARATOR| Modifier and Type | Method and Description |
|---|---|
void |
clear()
This method clears session's working memory and its beta-memory nodes as if the session
had never been used.
|
void |
close()
Closes the session and destroys its memory.
|
StatefulSession |
delete(FactHandle handle)
Deletes a fact from working memory.
|
StatefulSession |
fire()
Fire all rules.
|
default Future<StatefulSession> |
fireAsync()
Same as
fireAsync(Object), with the Future's get method will returning
the session itself. |
<T> Future<T> |
fireAsync(T result)
Fires session asynchronously and returns a Future representing the session execution
status.
|
StatefulSession |
forEachFact(BiConsumer<FactHandle,Object> consumer)
A full-scan memory inspection method.
|
default StatefulSession |
forEachFact(BiPredicate<FactHandle,Object> filter,
BiConsumer<FactHandle,Object> consumer) |
default <T> StatefulSession |
forEachFact(Class<T> type,
Consumer<T> consumer)
A memory inspection method that accepts fact type as an argument.
|
default <T> StatefulSession |
forEachFact(Class<T> type,
Predicate<T> filter,
Consumer<T> consumer)
A filtering version of the
forEachFact(Class, Consumer) method. |
<T> StatefulSession |
forEachFact(String type,
Consumer<T> consumer)
A memory inspection method that accepts fact type as an argument.
|
default <T> StatefulSession |
forEachFact(String type,
Predicate<T> filter,
Consumer<T> consumer)
A filtering version of the
forEachFact(String, Consumer) method. |
<T> T |
getFact(FactHandle handle)
Returns fact by its handle.
|
default StatefulSession |
insertAndFire(Collection<?> objects) |
default StatefulSession |
insertAndFire(Object... objects) |
StatefulSession |
update(FactHandle handle,
Object newValue)
Updates a fact that already exists in the working memory
|
addEventListener, asCollector, getActivationManager, getParentContext, insert, insert, insert, insert, insert, removeEventListener, setActivationManager, setExecutionPredicate, setFireCriteriagetActivationManagerFactory, getClassLoader, getConfiguration, getExpressionResolver, getRuleComparator, getService, getTypeResolver, newRule, newRule, setActivationManagerFactory, setActivationManagerFactory, setActivationMode, setClassLoader, setRuleComparator, wrapTypeResolveraddListener, removeListeneraddImport, addImport, getImports, getJavaImportssetget, get, getPropertyNamesaddEvaluator, addEvaluator, replaceEvaluatorcompileRule, getRule, getRule, getRules, ruleExistsStatefulSession fire()
fire in interface RuleSession<StatefulSession>StatefulSession update(FactHandle handle, Object newValue)
Updates a fact that already exists in the working memory
handle - fact handle, previously assigned to original factnewValue - an updated version of the factStatefulSession delete(FactHandle handle)
Deletes a fact from working memory.
handle - fact handle<T> T getFact(FactHandle handle)
Returns fact by its handle.
T - type of the fact (use Object or wildcard if type is unknown)handle - fact handlenull if fact is not found<T> Future<T> fireAsync(T result)
Fires session asynchronously and returns a Future representing the session execution status.
T - result type parameterresult - the result to return by the Futurefire() commandRejectedExecutionException - if the task cannot be
scheduled for executiondefault Future<StatefulSession> fireAsync()
Same as fireAsync(Object), with the Future's get method will returning
the session itself.
fire() command.RejectedExecutionException - if the task cannot be
scheduled for executionfireAsync(Object)void close()
Closes the session and destroys its memory. A closed session can not be reused.
close in interface AutoCloseablevoid clear()
This method clears session's working memory and its beta-memory nodes as if the session had never been used.
StatefulSession forEachFact(BiConsumer<FactHandle,Object> consumer)
A full-scan memory inspection method.
consumer - consumer for the factsdefault StatefulSession forEachFact(BiPredicate<FactHandle,Object> filter, BiConsumer<FactHandle,Object> consumer)
default <T> StatefulSession forEachFact(Class<T> type, Consumer<T> consumer)
A memory inspection method that accepts fact type as an argument.
T - expected java type for the provided type nametype - expected fact typeconsumer - consumer for the factsClassCastException - if a working memory object can not be cast to the specified typeIllegalArgumentException - if no such type existsTypeResolver<T> StatefulSession forEachFact(String type, Consumer<T> consumer)
A memory inspection method that accepts fact type as an argument. Type name can be either
a class name or a name of explicitly declared type. In the latter case, the generic type
parameter T must match the declared type's Java type (see Type.getJavaType())
T - expected java type for the provided type nametype - type nameconsumer - consumer for the factsClassCastException - if a working memory object can not be cast to the specified typeIllegalArgumentException - if no such type existsTypeResolverdefault <T> StatefulSession forEachFact(Class<T> type, Predicate<T> filter, Consumer<T> consumer)
A filtering version of the forEachFact(Class, Consumer) method.
T - expected java type for the provided type nametype - expected fact typeconsumer - consumer for the factsfilter - filtering predicateforEachFact(Class, Consumer)default <T> StatefulSession forEachFact(String type, Predicate<T> filter, Consumer<T> consumer)
A filtering version of the forEachFact(String, Consumer) method.
T - expected java type for the provided type nametype - expected fact typeconsumer - consumer for the factsfilter - filtering predicateforEachFact(String, Consumer)default StatefulSession insertAndFire(Collection<?> objects)
default StatefulSession insertAndFire(Object... objects)
Copyright © 2021. All rights reserved.