org.drools.reteoo
Class RightInputAdapterNode

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

public class RightInputAdapterNode
extends ObjectSource
implements TupleSinkNode, NodeMemory

When joining a subnetwork into the main network again, RightInputAdapterNode adapts the subnetwork's tuple into a fact in order right join it with the tuple being propagated in the main network.

Author:
Mark Proctor, Bob McWhirter, Edson Tirelli
See Also:
Serialized Form

Field Summary
protected  boolean tupleMemoryEnabled
           
 
Fields inherited from class org.drools.reteoo.ObjectSource
objectSource, sink
 
Fields inherited from class org.drools.common.BaseNode
id
 
Constructor Summary
RightInputAdapterNode(int id, TupleSource source, BuildContext context)
          Constructor specifying the unique id of the node in the Rete network, the position of the propagating FactHandleImpl in ReteTuple and the source that propagates the receive ReteTuples.
 
Method Summary
 void assertTuple(ReteTuple tuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Takes the asserted ReteTuple received from the TupleSource and adapts it into a FactHandleImpl
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 java.lang.Object createMemory(RuleBaseConfiguration config)
          Creates and return the node memory
 TupleSinkNode getNextTupleSinkNode()
          Returns the next node
 TupleSinkNode getPreviousTupleSinkNode()
          Returns the previous 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)
          Retracts the corresponding tuple by retrieving and retracting the fact created for it
 void setNextTupleSinkNode(TupleSinkNode next)
          Sets the next node
 void setPreviousTupleSinkNode(TupleSinkNode previous)
          Sets the previous node
 void setTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 
Methods inherited from class org.drools.reteoo.ObjectSource
addObjectSink, getSinkPropagator, isInUse, removeObjectSink
 
Methods inherited from class org.drools.common.BaseNode
getId, hashCode, toString
 
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
 

Field Detail

tupleMemoryEnabled

protected boolean tupleMemoryEnabled
Constructor Detail

RightInputAdapterNode

public RightInputAdapterNode(int id,
                             TupleSource source,
                             BuildContext context)
Constructor specifying the unique id of the node in the Rete network, the position of the propagating FactHandleImpl in ReteTuple and the source that propagates the receive ReteTuples.

Parameters:
id - Unique id
source - The TupleSource which propagates the received ReteTuple
Method Detail

createMemory

public java.lang.Object createMemory(RuleBaseConfiguration config)
Creates and return the node memory

Specified by:
createMemory in interface NodeMemory

assertTuple

public void assertTuple(ReteTuple tuple,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)
Takes the asserted ReteTuple received from the TupleSource and adapts it into a FactHandleImpl

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

retractTuple

public void retractTuple(ReteTuple tuple,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Retracts the corresponding tuple by retrieving and retracting the fact created for it

Specified by:
retractTuple in interface TupleSink

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

updateSink

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

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

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