public interface RhsContext
Rule activation context that provides access to the rule's variables and working memory methods.
| Modifier and Type | Method and Description |
|---|---|
RhsContext |
delete(Object obj)
This method removes an instance from the working memory.
|
default RhsContext |
deleteFact(String factRef) |
default <T> T |
get(String name)
A typed version of the
getObject() method. |
Object |
getObject(String name)
Returns current fact by its name
|
RuntimeRule |
getRule()
A convenience method that returns reference to the current rule and its
environment.
|
default RuntimeContext<?> |
getRuntime()
Provides access to the runtime context, an equivalent to
getRule().getRuntime(). |
default RhsContext |
insert(Collection<?> objects) |
RhsContext |
insert(Object obj)
Inserts a new object into the working memory.
|
default RhsContext |
insert(Object[] objects) |
RhsContext |
update(Object obj)
This method lets the working memory know that one of its objects has changed.
|
default RhsContext |
updateFact(String factRef) |
RhsContext insert(Object obj)
Inserts a new object into the working memory.
obj - the objectdefault RhsContext insert(Collection<?> objects)
default RhsContext insert(Object[] objects)
RhsContext update(Object obj)
This method lets the working memory know that one of its objects has changed. Always call this method to get conditions re-evaluated, and avoid calling it if the changes are not relevant to the conditions.
obj - the changed objectRhsContext delete(Object obj)
This method removes an instance from the working memory.
obj - the object to removeRuntimeRule getRule()
A convenience method that returns reference to the current rule and its environment.
default RuntimeContext<?> getRuntime()
Provides access to the runtime context, an equivalent to
getRule().getRuntime().
default RhsContext deleteFact(String factRef)
default RhsContext updateFact(String factRef)
Object getObject(String name)
Returns current fact by its name
name - the fact namedefault <T> T get(String name)
A typed version of the getObject() method.
T - cast typename - fact nameCopyright © 2021. All rights reserved.