org.drools.reteoo
Class QueryTerminalNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.QueryTerminalNode
All Implemented Interfaces:
Externalizable, Serializable, NetworkNode, LeftTupleSink, LeftTupleSinkNode, Sink, TerminalNode

public final class QueryTerminalNode
extends BaseNode
implements LeftTupleSinkNode, TerminalNode

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

See Also:
Rule, Serialized Form

Field Summary
static short type
           
 
Fields inherited from class org.drools.common.BaseNode
associations, id, partitionId, partitionsEnabled
 
Constructor Summary
QueryTerminalNode()
           
QueryTerminalNode(int id, LeftTupleSource source, Rule rule, GroupElement subrule, int subruleIndex, BuildContext context)
          Constructor
 
Method Summary
 void assertLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new Tuple.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 LeftTuple createLeftTuple(InternalFactHandle factHandle, LeftTupleSink sink, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, LeftTupleSink sink, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTuple currentLeftChild, LeftTuple currentRightChild, LeftTupleSink sink, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTupleSink sink)
           
protected  void doRemove(RuleRemovalContext context, ReteooBuilder builder, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 Declaration[] getDeclarations()
           
 long getDeclaredMask()
           
 long getInferredMask()
           
 int getLeftInputOtnId()
           
 LeftTupleSource getLeftTupleSource()
           
 long getNegativeMask()
           
 LeftTupleSinkNode getNextLeftTupleSinkNode()
          Returns the next node
 LeftTupleSinkNode getPreviousLeftTupleSinkNode()
          Returns the previous node
 Rule getRule()
           
 GroupElement getSubrule()
           
 int getSubruleIndex()
           
 short getType()
           
 void initDeclaredMask(BuildContext context)
           
 void initInferredMask()
           
 boolean isInUse()
          Returns true in case the current node is in use (is referenced by any other node)
 boolean isLeftTupleMemoryEnabled()
           
 void modifyLeftTuple(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void networkUpdated(UpdateContext updateContext)
          A method that is called for all nodes whose network below them changed, after the change is complete, providing them with an oportunity for state update
 void readExternal(ObjectInput in)
           
 void retractLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void ruleAttached()
           
 void setDeclaredMask(long mask)
           
 void setInferredMask(long mask)
           
 void setLeftInputOtnId(int leftInputOtnId)
           
 void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 void setNegativeMask(long mask)
           
 void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
          Sets the next node
 void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
          Sets the previous node
 String toString()
           
 LeftTupleSource unwrapTupleSource()
           
 void updateNewNode(InternalWorkingMemory workingMemory, PropagationContext context)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.common.BaseNode
addAssociation, getAssociations, getId, getPartitionId, hashCode, remove, removeAssociation, setPartitionId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public static final short type
See Also:
Constant Field Values
Constructor Detail

QueryTerminalNode

public QueryTerminalNode()

QueryTerminalNode

public QueryTerminalNode(int id,
                         LeftTupleSource source,
                         Rule rule,
                         GroupElement subrule,
                         int subruleIndex,
                         BuildContext context)
Constructor

Parameters:
id - node ID
source - the tuple source for this node
rule - the rule this node belongs to
subrule - the subrule this node belongs to
context - the current build context
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class BaseNode
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class BaseNode
Throws:
IOException

initDeclaredMask

public void initDeclaredMask(BuildContext context)

initInferredMask

public void initInferredMask()
Specified by:
initInferredMask in interface TerminalNode

getDeclaredMask

public long getDeclaredMask()
Specified by:
getDeclaredMask in interface TerminalNode

getInferredMask

public long getInferredMask()
Specified by:
getInferredMask in interface TerminalNode

getRule

public Rule getRule()

getLeftTupleSource

public LeftTupleSource getLeftTupleSource()
Specified by:
getLeftTupleSource in interface LeftTupleSink
Specified by:
getLeftTupleSource in interface TerminalNode

assertLeftTuple

public void assertLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Assert a new Tuple.

Specified by:
assertLeftTuple in interface LeftTupleSink
Parameters:
tuple - The Tuple being asserted.
workingMemory - The working memory seesion.
Throws:
AssertionException - If an error occurs while asserting.

retractLeftTuple

public void retractLeftTuple(LeftTuple leftTuple,
                             PropagationContext context,
                             InternalWorkingMemory workingMemory)
Specified by:
retractLeftTuple in interface LeftTupleSink

modifyLeftTuple

public void modifyLeftTuple(InternalFactHandle factHandle,
                            ModifyPreviousTuples modifyPreviousTuples,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Specified by:
modifyLeftTuple in interface LeftTupleSink

modifyLeftTuple

public void modifyLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Specified by:
modifyLeftTuple in interface LeftTupleSink

toString

public 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

networkUpdated

public void networkUpdated(UpdateContext updateContext)
Description copied from class: BaseNode
A method that is called for all nodes whose network below them changed, after the change is complete, providing them with an oportunity for state update

Specified by:
networkUpdated in class BaseNode

doRemove

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

Specified by:
doRemove 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)

isLeftTupleMemoryEnabled

public boolean isLeftTupleMemoryEnabled()
Specified by:
isLeftTupleMemoryEnabled in interface LeftTupleSink

setLeftTupleMemoryEnabled

public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)
Specified by:
setLeftTupleMemoryEnabled in interface LeftTupleSink

getSubrule

public GroupElement getSubrule()
Returns:
the subrule

getDeclarations

public Declaration[] getDeclarations()

getSubruleIndex

public int getSubruleIndex()

getPreviousLeftTupleSinkNode

public LeftTupleSinkNode getPreviousLeftTupleSinkNode()
Returns the previous node

Specified by:
getPreviousLeftTupleSinkNode in interface LeftTupleSinkNode
Returns:
The previous TupleSinkNode

setPreviousLeftTupleSinkNode

public void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
Sets the previous node

Specified by:
setPreviousLeftTupleSinkNode in interface LeftTupleSinkNode
Parameters:
previous - The previous TupleSinkNode

getNextLeftTupleSinkNode

public LeftTupleSinkNode getNextLeftTupleSinkNode()
Returns the next node

Specified by:
getNextLeftTupleSinkNode in interface LeftTupleSinkNode
Returns:
The next TupleSinkNode

setNextLeftTupleSinkNode

public void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
Sets the next node

Specified by:
setNextLeftTupleSinkNode in interface LeftTupleSinkNode
Parameters:
next - The next TupleSinkNode

getType

public short getType()
Specified by:
getType in interface LeftTupleSink

createLeftTuple

public LeftTuple createLeftTuple(InternalFactHandle factHandle,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)
Specified by:
createLeftTuple in interface LeftTupleSink

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)
Specified by:
createLeftTuple in interface LeftTupleSink

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTupleSink sink)
Specified by:
createLeftTuple in interface LeftTupleSink

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTuple currentLeftChild,
                                 LeftTuple currentRightChild,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)
Specified by:
createLeftTuple in interface LeftTupleSink

getLeftInputOtnId

public int getLeftInputOtnId()
Specified by:
getLeftInputOtnId in interface LeftTupleSink

setLeftInputOtnId

public void setLeftInputOtnId(int leftInputOtnId)
Specified by:
setLeftInputOtnId in interface LeftTupleSink

unwrapTupleSource

public LeftTupleSource unwrapTupleSource()
Specified by:
unwrapTupleSource in interface TerminalNode

setDeclaredMask

public void setDeclaredMask(long mask)
Specified by:
setDeclaredMask in interface TerminalNode

setInferredMask

public void setInferredMask(long mask)
Specified by:
setInferredMask in interface TerminalNode

getNegativeMask

public long getNegativeMask()
Specified by:
getNegativeMask in interface TerminalNode

setNegativeMask

public void setNegativeMask(long mask)
Specified by:
setNegativeMask in interface TerminalNode


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