org.drools.reteoo
Class EvalConditionNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.TupleSource
          extended by org.drools.reteoo.EvalConditionNode
All Implemented Interfaces:
java.io.Serializable, NetworkNode, NodeMemory, TupleSink, TupleSinkNode

public class EvalConditionNode
extends TupleSource
implements TupleSinkNode, NodeMemory

Node which filters ReteTuples.

Using a semantic Test, this node may allow or disallow Tuples to proceed further through the Rete-OO network.

Author:
Mark Proctor, Bob McWhirter
See Also:
EvalConditionNode, Eval, ReteTuple, Serialized Form

Nested Class Summary
static class EvalConditionNode.EvalMemory
           
 
Field Summary
protected  boolean tupleMemoryEnabled
           
 
Fields inherited from class org.drools.reteoo.TupleSource
sink
 
Fields inherited from class org.drools.common.BaseNode
id
 
Constructor Summary
EvalConditionNode(int id, TupleSource tupleSource, EvalCondition eval, BuildContext context)
          Construct.
 
Method Summary
 void assertTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new Tuple.
 void attach()
          Attaches this node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 java.lang.Object createMemory(RuleBaseConfiguration config)
           
 boolean equals(java.lang.Object object)
           
 EvalCondition getCondition()
          Retrieve the Test associated with this node.
 TupleSinkNode getNextTupleSinkNode()
          Returns the next node
 TupleSinkNode getPreviousTupleSinkNode()
          Returns the previous node
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isTupleMemoryEnabled()
           
 void remove(RuleRemovalContext context, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void retractTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void setNextTupleSinkNode(TupleSinkNode next)
          Sets the next node
 void setPreviousTupleSinkNode(TupleSinkNode previous)
          Sets the previous node
 void setTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 java.lang.String toString()
          Produce a debug string.
 void updateSink(TupleSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 
Methods inherited from class org.drools.reteoo.TupleSource
addTupleSink, getSinkPropagator, isInUse, removeTupleSink
 
Methods inherited from class org.drools.common.BaseNode
getId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Field Detail

tupleMemoryEnabled

protected boolean tupleMemoryEnabled
Constructor Detail

EvalConditionNode

public EvalConditionNode(int id,
                         TupleSource tupleSource,
                         EvalCondition eval,
                         BuildContext context)
Construct.

Parameters:
rule - The rule
tupleSource - The source of incoming Tuples.
eval -
Method Detail

attach

public void attach()
Attaches this node into the network.

Specified by:
attach in class BaseNode

attach

public void attach(InternalWorkingMemory[] workingMemories)
Specified by:
attach in class BaseNode

getCondition

public EvalCondition getCondition()
Retrieve the Test associated with this node.

Returns:
The Test.

assertTuple

public void assertTuple(ReteTuple tuple,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)
Assert a new Tuple.

Specified by:
assertTuple in interface TupleSink
Parameters:
tuple - The Tuple being asserted.
workingMemory - The working memory seesion.
context - The PropagationContext of the WorkingMemory action
Throws:
AssertionException - If an error occurs while asserting.

retractTuple

public void retractTuple(ReteTuple tuple,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Specified by:
retractTuple in interface TupleSink

toString

public java.lang.String toString()
Produce a debug string.

Overrides:
toString in class BaseNode
Returns:
The debug string.

hashCode

public int hashCode()
Description copied from class: BaseNode
The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).

Overrides:
hashCode in class BaseNode

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

createMemory

public java.lang.Object createMemory(RuleBaseConfiguration config)
Specified by:
createMemory in interface NodeMemory

updateSink

public void updateSink(TupleSink sink,
                       PropagationContext context,
                       InternalWorkingMemory workingMemory)
Specified by:
updateSink in class TupleSource

remove

public void remove(RuleRemovalContext context,
                   BaseNode node,
                   InternalWorkingMemory[] workingMemories)
Description copied from class: BaseNode
Removes the node from teh network. Usually from the parent ObjectSource or TupleSource

Specified by:
remove in class BaseNode

isTupleMemoryEnabled

public boolean isTupleMemoryEnabled()
Specified by:
isTupleMemoryEnabled in interface TupleSink

setTupleMemoryEnabled

public void setTupleMemoryEnabled(boolean tupleMemoryEnabled)
Specified by:
setTupleMemoryEnabled in interface TupleSink

getNextTupleSinkNode

public TupleSinkNode getNextTupleSinkNode()
Returns the next node

Specified by:
getNextTupleSinkNode in interface TupleSinkNode
Returns:
The next TupleSinkNode

setNextTupleSinkNode

public void setNextTupleSinkNode(TupleSinkNode next)
Sets the next node

Specified by:
setNextTupleSinkNode in interface TupleSinkNode
Parameters:
next - The next TupleSinkNode

getPreviousTupleSinkNode

public TupleSinkNode getPreviousTupleSinkNode()
Returns the previous node

Specified by:
getPreviousTupleSinkNode in interface TupleSinkNode
Returns:
The previous TupleSinkNode

setPreviousTupleSinkNode

public void setPreviousTupleSinkNode(TupleSinkNode previous)
Sets the previous node

Specified by:
setPreviousTupleSinkNode in interface TupleSinkNode
Parameters:
previous - The previous TupleSinkNode