org.drools.reteoo
Class QueryTerminalNode

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

public final class QueryTerminalNode
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
 
Fields inherited from class org.drools.common.BaseNode
id
 
Constructor Summary
QueryTerminalNode(int id, TupleSource source, Rule rule, GroupElement subrule)
          Construct.
 
Method Summary
 void assertTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new Tuple.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 java.lang.Object createMemory(RuleBaseConfiguration config)
           
 TupleSinkNode getNextTupleSinkNode()
          Returns the next node
 TupleSinkNode getPreviousTupleSinkNode()
          Returns the previous node
 Rule getRule()
          Retrieve the Action associated with this node.
 GroupElement getSubrule()
           
 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 tuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void ruleAttached()
           
 void setNextTupleSinkNode(TupleSinkNode next)
          Sets the next node
 void setPreviousTupleSinkNode(TupleSinkNode previous)
          Sets the previous node
 void setTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 java.lang.String toString()
           
 void updateNewNode(InternalWorkingMemory workingMemory, PropagationContext context)
           
 
Methods inherited from class org.drools.common.BaseNode
getId, hashCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Constructor Detail

QueryTerminalNode

public QueryTerminalNode(int id,
                         TupleSource source,
                         Rule rule,
                         GroupElement subrule)
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.

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()
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:

updateNewNode

public void updateNewNode(InternalWorkingMemory workingMemory,
                          PropagationContext context)

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

getSubrule

public GroupElement getSubrule()
Returns:
the subrule

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

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