org.drools.reteoo
Class EvalConditionNode

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

public class EvalConditionNode
extends LeftTupleSource
implements LeftTupleSinkNode, NodeMemory

Node which filters ReteTuples.

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

See Also:
EvalConditionNode, Eval, LeftTuple, Serialized Form

Nested Class Summary
static class EvalConditionNode.EvalMemory
           
 
Field Summary
protected  boolean tupleMemoryEnabled
           
 
Fields inherited from class org.drools.reteoo.LeftTupleSource
sink
 
Fields inherited from class org.drools.common.BaseNode
associations, id, partitionId, partitionsEnabled
 
Constructor Summary
EvalConditionNode()
           
EvalConditionNode(int id, LeftTupleSource tupleSource, EvalCondition eval, BuildContext context)
          Construct.
 
Method Summary
 void assertLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new Tuple.
 void attach()
          Attaches this 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)
           
 Memory createMemory(RuleBaseConfiguration config)
           
protected  void doRemove(RuleRemovalContext context, ReteooBuilder builder, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 boolean equals(Object object)
           
 EvalCondition getCondition()
          Retrieve the Test associated with this node.
 LeftTupleSource getLeftTupleSource()
           
 LeftTupleSinkNode getNextLeftTupleSinkNode()
          Returns the next node
 LeftTupleSinkNode getPreviousLeftTupleSinkNode()
          Returns the previous node
 short getType()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isLeftTupleMemoryEnabled()
           
 void modifyLeftTuple(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void networkUpdated()
          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 setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
          Sets the next node
 void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
          Sets the previous node
 String toString()
          Produce a debug string.
 void updateSink(LeftTupleSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.reteoo.LeftTupleSource
addTupleSink, getSinkPropagator, isInUse, removeTupleSink
 
Methods inherited from class org.drools.common.BaseNode
addAssociation, getAssociations, getId, getPartitionId, remove, removeAssociation, setPartitionId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NetworkNode
getId, getPartitionId
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Field Detail

tupleMemoryEnabled

protected boolean tupleMemoryEnabled
Constructor Detail

EvalConditionNode

public EvalConditionNode()

EvalConditionNode

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

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

readExternal

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

writeExternal

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

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

networkUpdated

public void networkUpdated()
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

getCondition

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

Returns:
The Test.

getLeftTupleSource

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

assertLeftTuple

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

Specified by:
assertLeftTuple in interface LeftTupleSink
Parameters:
leftTuple - The Tuple being asserted.
workingMemory - The working memory seesion.
context - The PropagationContext of the WorkingMemory action
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()
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(Object object)
Overrides:
equals in class Object

createMemory

public Memory createMemory(RuleBaseConfiguration config)
Specified by:
createMemory in interface NodeMemory

updateSink

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

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

isLeftTupleMemoryEnabled

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

setLeftTupleMemoryEnabled

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

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

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

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


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