Package org.drools.core.rule
Class SlidingLengthWindow
- java.lang.Object
-
- org.drools.core.rule.SlidingLengthWindow
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,Behavior,RuleComponent
public class SlidingLengthWindow extends java.lang.Object implements java.io.Externalizable, Behavior
A length window behavior implementation- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSlidingLengthWindow.SlidingLengthWindowContextA Context object for length windows-
Nested classes/interfaces inherited from interface org.drools.core.rule.Behavior
Behavior.BehaviorType, Behavior.Context
-
-
Field Summary
Fields Modifier and Type Field Description protected intsize
-
Constructor Summary
Constructors Constructor Description SlidingLengthWindow()SlidingLengthWindow(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanassertFact(java.lang.Object context, InternalFactHandle handle, PropagationContext pctx, ReteEvaluator reteEvaluator)Makes the behavior aware of the new fact entering behavior's scopeBehavior.ContextcreateContext()Creates the context object associated with this behavior.voidexpireFacts(java.lang.Object context, PropagationContext pctx, ReteEvaluator reteEvaluator)A callback method that allows behaviors to expire factslonggetExpirationOffset()Length windows don't change expiration offset, so always return -1longgetSize()Behavior.BehaviorTypegetType()Returns the type of the behaviorvoidreadExternal(java.io.ObjectInput in)voidretractFact(java.lang.Object context, InternalFactHandle handle, PropagationContext pctx, ReteEvaluator reteEvaluator)Removes a right tuple from the behavior's scopevoidsetSize(int size)java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Method Detail
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
getType
public Behavior.BehaviorType getType()
Description copied from interface:BehaviorReturns the type of the behavior
-
getSize
public long getSize()
- Returns:
- the size
-
setSize
public void setSize(int size)
- Parameters:
size- the size to set
-
createContext
public Behavior.Context createContext()
Description copied from interface:BehaviorCreates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.- Specified by:
createContextin interfaceBehavior
-
assertFact
public boolean assertFact(java.lang.Object context, InternalFactHandle handle, PropagationContext pctx, ReteEvaluator reteEvaluator)Description copied from interface:BehaviorMakes the behavior aware of the new fact entering behavior's scope- Specified by:
assertFactin interfaceBehavior- Parameters:
context- The behavior context objecthandle- The new fact entering behavior's scopereteEvaluator- 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
public void retractFact(java.lang.Object context, InternalFactHandle handle, PropagationContext pctx, ReteEvaluator reteEvaluator)Description copied from interface:BehaviorRemoves a right tuple from the behavior's scope- Specified by:
retractFactin interfaceBehavior- Parameters:
context- The behavior context objecthandle- The fact leaving the behavior's scopereteEvaluator- The working memory session reference
-
expireFacts
public void expireFacts(java.lang.Object context, PropagationContext pctx, ReteEvaluator reteEvaluator)Description copied from interface:BehaviorA callback method that allows behaviors to expire facts- Specified by:
expireFactsin interfaceBehavior
-
getExpirationOffset
public long getExpirationOffset()
Length windows don't change expiration offset, so always return -1- Specified by:
getExpirationOffsetin interfaceBehavior- Returns:
- the expiration offset for this behavior or -1 if they don't have a time based expiration offset.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-