Drools :: Core 6.1.0.Beta1

org.drools.core.rule
Interface Behavior

All Superinterfaces:
Cloneable, RuleComponent
All Known Implementing Classes:
SlidingLengthWindow, SlidingTimeWindow

public interface Behavior
extends RuleComponent, Cloneable

An interface for all behavior implementations


Nested Class Summary
static class Behavior.BehaviorType
           
 
Field Summary
static Behavior[] EMPTY_BEHAVIOR_LIST
           
 
Method Summary
 boolean assertFact(WindowNode.WindowMemory memory, Object context, InternalFactHandle fact, PropagationContext pctx, 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 expireFacts(WindowNode.WindowMemory memory, Object context, PropagationContext pctx, InternalWorkingMemory workingMemory)
          A callback method that allows behaviors to expire facts
 long getExpirationOffset()
          Some behaviors might change the expiration offset for the associated fact type.
 Behavior.BehaviorType getType()
          Returns the type of the behavior
 void retractFact(WindowNode.WindowMemory memory, Object context, InternalFactHandle fact, PropagationContext pctx, InternalWorkingMemory workingMemory)
          Removes a right tuple from the behavior's scope
 

Field Detail

EMPTY_BEHAVIOR_LIST

static final Behavior[] EMPTY_BEHAVIOR_LIST
Method Detail

getType

Behavior.BehaviorType getType()
Returns the type of the behavior

Returns:

createContext

Object createContext()
Creates the context object associated with this behavior. The object is given as a parameter in all behavior call backs.

Returns:

assertFact

boolean assertFact(WindowNode.WindowMemory memory,
                   Object context,
                   InternalFactHandle fact,
                   PropagationContext pctx,
                   InternalWorkingMemory workingMemory)
Makes the behavior aware of the new fact entering behavior's scope

Parameters:
memory - The window node memory
context - The behavior context object
fact - 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.

retractFact

void retractFact(WindowNode.WindowMemory memory,
                 Object context,
                 InternalFactHandle fact,
                 PropagationContext pctx,
                 InternalWorkingMemory workingMemory)
Removes a right tuple from the behavior's scope

Parameters:
memory - The window node memory
context - The behavior context object
fact - The fact leaving the behavior's scope
workingMemory - The working memory session reference

expireFacts

void expireFacts(WindowNode.WindowMemory memory,
                 Object context,
                 PropagationContext pctx,
                 InternalWorkingMemory workingMemory)
A callback method that allows behaviors to expire facts

Parameters:
memory - The window node memory
context - The behavior context object
workingMemory - The working memory session reference

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.

Returns:
the expiration offset for this behavior or -1 if they don't have a time based expiration offset.

Drools :: Core 6.1.0.Beta1

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