Package org.drools.core.rule
Interface BehaviorRuntime
-
- All Superinterfaces:
org.drools.base.rule.Behavior
,java.lang.Cloneable
,org.drools.base.rule.RuleComponent
- All Known Implementing Classes:
SlidingLengthWindow
,SlidingTimeWindow
public interface BehaviorRuntime extends org.drools.base.rule.Behavior, org.drools.base.rule.RuleComponent, java.lang.Cloneable
An interface for all behavior implementations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
assertFact(java.lang.Object context, org.kie.api.runtime.rule.FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator)
Makes the behavior aware of the new fact entering behavior's scopeBehaviorContext
createContext()
Creates the context object associated with this behavior.void
expireFacts(java.lang.Object context, PropagationContext pctx, ReteEvaluator reteEvaluator)
A callback method that allows behaviors to expire factslong
getExpirationOffset()
Some behaviors might change the expiration offset for the associated fact type.org.drools.base.rule.Behavior.BehaviorType
getType()
Returns the type of the behaviorvoid
retractFact(java.lang.Object context, org.kie.api.runtime.rule.FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator)
Removes a right tuple from the behavior's scope
-
-
-
Method Detail
-
getType
org.drools.base.rule.Behavior.BehaviorType getType()
Returns the type of the behavior- Specified by:
getType
in interfaceorg.drools.base.rule.Behavior
-
createContext
BehaviorContext createContext()
Creates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.
-
assertFact
boolean assertFact(java.lang.Object context, org.kie.api.runtime.rule.FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator)
Makes the behavior aware of the new fact entering behavior's scope- Parameters:
context
- The behavior context objectfact
- The new fact entering behavior's scopevalueResolver
- The working memory session reference- Returns:
- true if the propagation should continue, false otherwise. I.e., the behaviour has veto power over the fact propagation, and prevents the propagation to continue if returns false on this method.
-
retractFact
void retractFact(java.lang.Object context, org.kie.api.runtime.rule.FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator)
Removes a right tuple from the behavior's scope- Parameters:
context
- The behavior context objectfact
- The fact leaving the behavior's scopevalueResolver
- The working memory session reference
-
expireFacts
void expireFacts(java.lang.Object context, PropagationContext pctx, ReteEvaluator reteEvaluator)
A callback method that allows behaviors to expire facts
-
getExpirationOffset
long getExpirationOffset()
Some behaviors might change the expiration offset for the associated fact type. Example: time sliding windows. For these behaviors, this method must return the expiration offset associated to them.- Specified by:
getExpirationOffset
in interfaceorg.drools.base.rule.Behavior
- Returns:
- the expiration offset for this behavior or -1 if they don't have a time based expiration offset.
-
-