Package org.drools.core.rule
Class SlidingTimeWindow
java.lang.Object
org.drools.core.rule.SlidingTimeWindow
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Behavior,RuleComponent,BehaviorRuntime
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classNested classes/interfaces inherited from interface org.drools.base.rule.Behavior
Behavior.BehaviorType -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanassertFact(Object context, FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator) Makes the behavior aware of the new fact entering behavior's scopeCreates the context object associated with this behavior.voidexpireFacts(Object context, PropagationContext pctx, ReteEvaluator reteEvaluator) A callback method that allows behaviors to expire factslongSome behaviors might change the expiration offset for the associated fact type.longgetSize()getType()Returns the type of the behaviorprotected booleanisExpired(long currentTime, DefaultEventHandle handle) voidvoidretractFact(Object context, FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator) Removes a right tuple from the behavior's scopevoidsetSize(long size) voidsetWindowNode(WindowNode windowNode) toString()protected voidupdateNextExpiration(InternalFactHandle fact, ReteEvaluator reteEvaluator, BehaviorContext context, int nodeId) void
-
Field Details
-
size
protected long size -
nodeId
protected int nodeId
-
-
Constructor Details
-
SlidingTimeWindow
public SlidingTimeWindow() -
SlidingTimeWindow
public SlidingTimeWindow(long size)
-
-
Method Details
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
getType
Description copied from interface:BehaviorRuntimeReturns the type of the behavior- Specified by:
getTypein interfaceBehavior- Specified by:
getTypein interfaceBehaviorRuntime
-
setWindowNode
-
getSize
public long getSize()- Returns:
- the size
-
setSize
public void setSize(long size) - Parameters:
size- the size to set
-
createContext
Description copied from interface:BehaviorRuntimeCreates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.- Specified by:
createContextin interfaceBehaviorRuntime
-
assertFact
public boolean assertFact(Object context, FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator) Description copied from interface:BehaviorRuntimeMakes the behavior aware of the new fact entering behavior's scope- Specified by:
assertFactin interfaceBehaviorRuntime- Parameters:
context- The behavior context objectfact- The new fact entering behavior's scope- 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
public void retractFact(Object context, FactHandle fact, PropagationContext pctx, ReteEvaluator reteEvaluator) Description copied from interface:BehaviorRuntimeRemoves a right tuple from the behavior's scope- Specified by:
retractFactin interfaceBehaviorRuntime- Parameters:
context- The behavior context objectfact- The fact leaving the behavior's scope
-
expireFacts
Description copied from interface:BehaviorRuntimeA callback method that allows behaviors to expire facts- Specified by:
expireFactsin interfaceBehaviorRuntime
-
isExpired
-
updateNextExpiration
protected void updateNextExpiration(InternalFactHandle fact, ReteEvaluator reteEvaluator, BehaviorContext context, int nodeId) -
getExpirationOffset
public long getExpirationOffset()Description copied from interface:BehaviorRuntimeSome 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:
getExpirationOffsetin interfaceBehavior- Specified by:
getExpirationOffsetin interfaceBehaviorRuntime- Returns:
- the expiration offset for this behavior or -1 if they don't have a time based expiration offset.
-
toString
-