org.drools.reteoo
Class RuleTerminalNode

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

public final class RuleTerminalNode
extends BaseNode
implements TupleSinkNode, NodeMemory, TerminalNode

Leaf Rete-OO node responsible for enacting Action s on a matched Rule.

Author:
bob mcwhirter
See Also:
Rule, Serialized Form

Field Summary
protected  boolean tupleMemoryEnabled
           
 
Fields inherited from class org.drools.common.BaseNode
id
 
Constructor Summary
RuleTerminalNode(int id, TupleSource source, Rule rule, GroupElement subrule, BuildContext buildContext)
          Construct.
 
Method Summary
 void assertTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new ReteTuple.
 void assertTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory, boolean fireActivationCreated)
          Assert a new Tuple.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 java.lang.Object createMemory(RuleBaseConfiguration config)
           
 boolean equals(java.lang.Object object)
           
 TupleSinkNode getNextTupleSinkNode()
          Returns the next node
 TupleSinkNode getPreviousTupleSinkNode()
          Returns the previous node
 Rule getRule()
          Retrieve the Action associated with this node.
 int getSequence()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isInUse()
          Returns true in case the current node is in use (is referenced by any other node)
 boolean isTupleMemoryEnabled()
           
 void remove(RuleRemovalContext context, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void retractTuple(ReteTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void ruleAttached()
           
 void setNextTupleSinkNode(TupleSinkNode next)
          Sets the next node
 void setPreviousTupleSinkNode(TupleSinkNode previous)
          Sets the previous node
 void setSequence(int seq)
           
 void setTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 java.lang.String toString()
           
 
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

RuleTerminalNode

public RuleTerminalNode(int id,
                        TupleSource source,
                        Rule rule,
                        GroupElement subrule,
                        BuildContext buildContext)
Construct.

Parameters:
inputSource - The parent tuple source.
rule - The rule.
Method Detail

getRule

public Rule getRule()
Retrieve the Action associated with this node.

Returns:
The Action associated with this node.

setSequence

public void setSequence(int seq)

getSequence

public int getSequence()

assertTuple

public void assertTuple(ReteTuple tuple,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)
Description copied from interface: TupleSink
Assert a new ReteTuple.

Specified by:
assertTuple in interface TupleSink
Parameters:
tuple - The ReteTuple to propagate.
context - The PropagationContext of the WorkingMemory action
workingMemory - the WorkingMemory session.

assertTuple

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

Parameters:
tuple - The Tuple being asserted.
workingMemory - The working memory seesion.
Throws:
AssertionException - If an error occurs while asserting.

retractTuple

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

toString

public java.lang.String toString()
Overrides:
toString in class BaseNode

ruleAttached

public void ruleAttached()

attach

public void attach()
Description copied from class: BaseNode
Attaches the node into the network. Usually to the parent ObjectSource or TupleSource

Specified by:
attach in class BaseNode

attach

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

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

isInUse

public boolean isInUse()
Description copied from class: BaseNode
Returns true in case the current node is in use (is referenced by any other node)

Specified by:
isInUse in class BaseNode
Returns:

createMemory

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

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

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