Package org.evrete.api
Interface RhsContext
public interface RhsContext
Rule activation context that provides access to the rule's variables and working memory methods.
-
Method Summary
Modifier and Type Method Description RhsContextdelete(Object obj)This method removes an instance from the working memory.default RhsContextdeleteFact(String factRef)default <T> Tget(String name)A typed version of thegetObject()method.ObjectgetObject(String name)Returns current fact by its nameRuntimeRulegetRule()A convenience method that returns reference to the current rule and its environment.default RuntimeContext<?>getRuntime()Provides access to the runtime context, an equivalent togetRule().getRuntime().RhsContextinsert(Object obj)Inserts a new object into the working memory.default RhsContextinsert(Object[] objects)default RhsContextinsert(Collection<?> objects)RhsContextupdate(Object obj)This method lets the working memory know that one of its objects has changed.default RhsContextupdateFact(String factRef)
-
Method Details
-
insert
Inserts a new object into the working memory.
- Parameters:
obj- the object- Returns:
- the context itself so the methods could be chained
-
insert
-
insert
-
update
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.
- Parameters:
obj- the changed object- Returns:
- the context itself so the methods could be chained
-
delete
This method removes an instance from the working memory.
- Parameters:
obj- the object to remove- Returns:
- the context itself so the methods could be chained
-
getRule
RuntimeRule getRule()A convenience method that returns reference to the current rule and its environment.
- Returns:
- current rule
-
getRuntime
Provides access to the runtime context, an equivalent to
getRule().getRuntime().- Returns:
- runtime context (session)
-
deleteFact
-
updateFact
-
getObject
Returns current fact by its name
- Parameters:
name- the fact name- Returns:
- current instance
-
get
A typed version of the
getObject()method.- Type Parameters:
T- cast type- Parameters:
name- fact name- Returns:
- current instance
-