Drools :: Core 6.1.0.Beta1

org.drools.core.reteoo
Class RuleTerminalNode

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

public class RuleTerminalNode
extends AbstractTerminalNode

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

See Also:
Rule, Serialized Form

Nested Class Summary
static class RuleTerminalNode.RTNCleanupAdapter
           
static class RuleTerminalNode.SortDeclarations
           
 
Field Summary
protected  String consequenceName
           
protected  Declaration[] declarations
           
protected  Declaration[] enabledDeclarations
           
protected  boolean fireDirect
           
protected  ObjectTypeNode.Id leftInputOtnId
           
protected  LeftTupleSinkNode nextTupleSinkNode
           
protected  LeftTupleSinkNode previousTupleSinkNode
           
protected  Rule rule
          The rule to invoke upon match.
protected  Declaration[] salienceDeclarations
           
protected  GroupElement subrule
          the subrule reference is needed to resolve declarations because declarations may have different offsets in each subrule
protected  int subruleIndex
           
protected  Declaration[][] timerDeclarations
           
 
Fields inherited from class org.drools.core.common.BaseNode
associations, id, partitionId, partitionsEnabled, streamMode
 
Constructor Summary
RuleTerminalNode()
           
RuleTerminalNode(int id, LeftTupleSource source, Rule rule, GroupElement subrule, int subruleIndex, BuildContext context)
           
 
Method Summary
 void assertLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new ReteTuple.
 void attach(BuildContext context)
          Attaches the node into the network.
 void cancelMatch(AgendaItem match, InternalWorkingMemoryActions workingMemory)
           
 LeftTuple createLeftTuple(InternalFactHandle factHandle, LeftTuple leftTuple, LeftTupleSink sink)
           
 LeftTuple createLeftTuple(InternalFactHandle factHandle, LeftTupleSink sink, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, LeftTupleSink sink, PropagationContext pctx, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTuple currentLeftChild, LeftTuple currentRightChild, LeftTupleSink sink, boolean leftTupleMemoryEnabled)
           
 LeftTuple createLeftTuple(LeftTuple leftTuple, RightTuple rightTuple, LeftTupleSink sink)
           
 boolean equals(Object object)
           
static PropagationContext findMostRecentPropagationContext(LeftTuple leftTuple, PropagationContext context)
           
 String getConsequenceName()
           
 Declaration[] getDeclarations()
           
 Declaration[] getEnabledDeclarations()
           
 ObjectTypeNode.Id getLeftInputOtnId()
           
 LeftTupleSinkNode getNextLeftTupleSinkNode()
          Returns the next node
protected  ObjectTypeNode getObjectTypeNode()
           
 LeftTupleSinkNode getPreviousLeftTupleSinkNode()
          Returns the previous node
 Rule getRule()
          Retrieve the Action associated with this node.
 Declaration[] getSalienceDeclarations()
           
 GroupElement getSubRule()
           
 Declaration[][] getTimerDeclarations()
           
 short getType()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isFireDirect()
           
 boolean isInUse()
          Returns true in case the current node is in use (is referenced by any other node)
 boolean isLeftTupleMemoryEnabled()
           
 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 setConsequenceName(String consequenceName)
           
 void setDeclarations(Map<String,Declaration> decls)
           
 void setEnabledDeclarations(Declaration[] enabledDeclarations)
           
 void setFireDirect(boolean fireDirect)
           
 void setLeftInputOtnId(ObjectTypeNode.Id leftInputOtnId)
           
 void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
          Sets the next node
 void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
          Sets the previous node
 void setSalienceDeclarations(Declaration[] salienceDeclarations)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.core.reteoo.AbstractTerminalNode
createMemory, createPeer, doRemove, getDeclaredMask, getInferredMask, getLeftInferredMask, getLeftTupleSource, getNegativeMask, initDeclaredMask, initInferredMask, initPathMemory, modifyLeftTuple, setDeclaredMask, setInferredMask, setNegativeMask, unwrapTupleSource
 
Methods inherited from class org.drools.core.common.BaseNode
addAssociation, attach, getAssociations, getId, getPartitionId, isStreamMode, remove, removeAssociation, setId, setPartitionId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.core.common.NetworkNode
getAssociations, getId, getPartitionId
 
Methods inherited from interface org.drools.core.common.MemoryFactory
getId
 

Field Detail

rule

protected Rule rule
The rule to invoke upon match.


subrule

protected GroupElement subrule
the subrule reference is needed to resolve declarations because declarations may have different offsets in each subrule


subruleIndex

protected int subruleIndex

declarations

protected Declaration[] declarations

timerDeclarations

protected Declaration[][] timerDeclarations

salienceDeclarations

protected Declaration[] salienceDeclarations

enabledDeclarations

protected Declaration[] enabledDeclarations

previousTupleSinkNode

protected LeftTupleSinkNode previousTupleSinkNode

nextTupleSinkNode

protected LeftTupleSinkNode nextTupleSinkNode

fireDirect

protected boolean fireDirect

leftInputOtnId

protected transient ObjectTypeNode.Id leftInputOtnId

consequenceName

protected String consequenceName
Constructor Detail

RuleTerminalNode

public RuleTerminalNode()

RuleTerminalNode

public RuleTerminalNode(int id,
                        LeftTupleSource source,
                        Rule rule,
                        GroupElement subrule,
                        int subruleIndex,
                        BuildContext context)
Parameters:
id -
source -
rule -
subrule -
subruleIndex -
context -
Method Detail

setDeclarations

public void setDeclarations(Map<String,Declaration> decls)

readExternal

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

writeExternal

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

getRule

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

Specified by:
getRule in interface TerminalNode
Specified by:
getRule in class AbstractTerminalNode
Returns:
The Action associated with this node.

getSubRule

public GroupElement getSubRule()

findMostRecentPropagationContext

public static PropagationContext findMostRecentPropagationContext(LeftTuple leftTuple,
                                                                  PropagationContext context)

toString

public String toString()
Overrides:
toString in class BaseNode

attach

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

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

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:

isLeftTupleMemoryEnabled

public boolean isLeftTupleMemoryEnabled()

setLeftTupleMemoryEnabled

public void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)

getDeclarations

public Declaration[] getDeclarations()

getTimerDeclarations

public Declaration[][] getTimerDeclarations()

getSalienceDeclarations

public Declaration[] getSalienceDeclarations()

setSalienceDeclarations

public void setSalienceDeclarations(Declaration[] salienceDeclarations)

getEnabledDeclarations

public Declaration[] getEnabledDeclarations()

setEnabledDeclarations

public void setEnabledDeclarations(Declaration[] enabledDeclarations)

getConsequenceName

public String getConsequenceName()

setConsequenceName

public void setConsequenceName(String consequenceName)

cancelMatch

public void cancelMatch(AgendaItem match,
                        InternalWorkingMemoryActions workingMemory)

getNextLeftTupleSinkNode

public LeftTupleSinkNode getNextLeftTupleSinkNode()
Returns the next node

Returns:
The next TupleSinkNode

setNextLeftTupleSinkNode

public void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
Sets the next node

Parameters:
next - The next TupleSinkNode

getPreviousLeftTupleSinkNode

public LeftTupleSinkNode getPreviousLeftTupleSinkNode()
Returns the previous node

Returns:
The previous TupleSinkNode

setPreviousLeftTupleSinkNode

public void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
Sets the previous node

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(Object object)
Overrides:
equals in class Object

getType

public short getType()

createLeftTuple

public LeftTuple createLeftTuple(InternalFactHandle factHandle,
                                 LeftTuple leftTuple,
                                 LeftTupleSink sink)

createLeftTuple

public LeftTuple createLeftTuple(InternalFactHandle factHandle,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 LeftTupleSink sink,
                                 PropagationContext pctx,
                                 boolean leftTupleMemoryEnabled)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTupleSink sink)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTuple currentLeftChild,
                                 LeftTuple currentRightChild,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)

getLeftInputOtnId

public ObjectTypeNode.Id getLeftInputOtnId()

setLeftInputOtnId

public void setLeftInputOtnId(ObjectTypeNode.Id leftInputOtnId)

isFireDirect

public boolean isFireDirect()

setFireDirect

public void setFireDirect(boolean fireDirect)

getObjectTypeNode

protected ObjectTypeNode getObjectTypeNode()

assertLeftTuple

public void assertLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Description copied from interface: LeftTupleSink
Assert a new ReteTuple.

Parameters:
leftTuple - The ReteTuple to propagate.
context - The PropagationContext of the WorkingMemory action
workingMemory - the WorkingMemory session.

retractLeftTuple

public void retractLeftTuple(LeftTuple leftTuple,
                             PropagationContext context,
                             InternalWorkingMemory workingMemory)

modifyLeftTuple

public void modifyLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)

Drools :: Core 6.1.0.Beta1

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