org.drools.rule
Class SlidingTimeWindow

java.lang.Object
  extended by org.drools.rule.SlidingTimeWindow
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Behavior, RuleComponent

public class SlidingTimeWindow
extends Object
implements Externalizable, Behavior

See Also:
Serialized Form

Nested Class Summary
static class SlidingTimeWindow.BehaviorExpireWMAction
           
static class SlidingTimeWindow.BehaviorJob
           
static class SlidingTimeWindow.BehaviorJobContext
           
static class SlidingTimeWindow.BehaviorJobContextTimerInputMarshaller
           
static class SlidingTimeWindow.BehaviorJobContextTimerOutputMarshaller
           
static class SlidingTimeWindow.SlidingTimeWindowContext
           
 
Nested classes/interfaces inherited from interface org.drools.rule.Behavior
Behavior.BehaviorType
 
Field Summary
static SlidingTimeWindow.BehaviorJob job
           
 
Fields inherited from interface org.drools.rule.Behavior
EMPTY_BEHAVIOR_LIST
 
Constructor Summary
SlidingTimeWindow()
           
SlidingTimeWindow(long size)
           
 
Method Summary
 boolean assertRightTuple(PropagationContext pctx, Object context, RightTuple rightTuple, InternalWorkingMemory workingMemory)
          Makes the behavior aware of the new fact entering behavior's scope
 Object createContext()
          Creates the context object associated with this behavior.
 void expireTuples(Object context, InternalWorkingMemory workingMemory)
          A callback method that allows behaviors to expire tuples
 long getExpirationOffset()
          Some behaviors might change the expiration offset for the associated fact type.
 long getSize()
           
 Behavior.BehaviorType getType()
          Returns the type of the behavior
 void readExternal(ObjectInput in)
           
 void retractRightTuple(Object context, RightTuple rightTuple, InternalWorkingMemory workingMemory)
          Removes a right tuple from the behavior's scope
 void setSize(long size)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

job

public static final SlidingTimeWindow.BehaviorJob job
Constructor Detail

SlidingTimeWindow

public SlidingTimeWindow()

SlidingTimeWindow

public SlidingTimeWindow(long size)
Parameters:
size -
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException
See Also:
Externalizable.readExternal(java.io.ObjectInput)

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException
See Also:
Externalizable.writeExternal(java.io.ObjectOutput)

getType

public Behavior.BehaviorType getType()
Description copied from interface: Behavior
Returns the type of the behavior

Specified by:
getType in interface Behavior
Returns:

getSize

public long getSize()
Returns:
the size

setSize

public void setSize(long size)
Parameters:
size - the size to set

createContext

public Object createContext()
Description copied from interface: Behavior
Creates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.

Specified by:
createContext in interface Behavior
Returns:

assertRightTuple

public boolean assertRightTuple(PropagationContext pctx,
                                Object context,
                                RightTuple rightTuple,
                                InternalWorkingMemory workingMemory)
Description copied from interface: Behavior
Makes the behavior aware of the new fact entering behavior's scope

Specified by:
assertRightTuple in interface Behavior
context - The behavior context object
rightTuple - The new fact entering behavior's scope
workingMemory - 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.
See Also:
org.drools.rule.Behavior#assertRightTuple(java.lang.Object, org.drools.reteoo.RightTuple, org.drools.common.InternalWorkingMemory)

retractRightTuple

public void retractRightTuple(Object context,
                              RightTuple rightTuple,
                              InternalWorkingMemory workingMemory)
Description copied from interface: Behavior
Removes a right tuple from the behavior's scope

Specified by:
retractRightTuple in interface Behavior
Parameters:
context - The behavior context object
rightTuple - The tuple leaving the behavior's scope
workingMemory - The working memory session reference
See Also:
Behavior.retractRightTuple(java.lang.Object, org.drools.reteoo.RightTuple, org.drools.common.InternalWorkingMemory)

expireTuples

public void expireTuples(Object context,
                         InternalWorkingMemory workingMemory)
Description copied from interface: Behavior
A callback method that allows behaviors to expire tuples

Specified by:
expireTuples in interface Behavior
Parameters:
context - The behavior context object
workingMemory - The working memory session reference

getExpirationOffset

public long getExpirationOffset()
Description copied from interface: Behavior
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 interface Behavior
Returns:
the expiration offset for this behavior or -1 if they don't have a time based expiration offset.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.