Drools :: Core 6.0.0.Beta5

org.drools.core.reteoo
Class RightInputAdapterNode

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

public class RightInputAdapterNode
extends ObjectSource
implements LeftTupleSinkNode, MemoryFactory

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.

See Also:
Serialized Form

Nested Class Summary
static class RightInputAdapterNode.RiaNodeMemory
           
 
Field Summary
 
Fields inherited from class org.drools.core.reteoo.ObjectSource
declaredMask, inferredMask, sink, source
 
Fields inherited from class org.drools.core.common.BaseNode
associations, id, partitionId, partitionsEnabled, streamMode
 
Constructor Summary
RightInputAdapterNode()
           
RightInputAdapterNode(int id, LeftTupleSource source, LeftTupleSource startTupleSource, 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 assertLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Takes the asserted ReteTuple received from the TupleSource and adapts it into a FactHandleImpl
 void attach(BuildContext context)
          Attaches the node into the network.
 long calculateDeclaredMask(List<String> settableProperties)
           
 InternalFactHandle createFactHandle(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory 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)
           
 Memory createMemory(RuleBaseConfiguration config, InternalWorkingMemory wm)
          Creates and return the node memory
 LeftTuple createPeer(LeftTuple original)
           
protected  void doCollectAncestors(NodeSet nodeSet)
           
protected  void doRemove(RuleRemovalContext context, ReteooBuilder builder, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 boolean equals(Object object)
           
 long getLeftInferredMask()
           
 ObjectTypeNode.Id getLeftInputOtnId()
           
 LeftTupleSource getLeftTupleSource()
           
 LeftTupleSinkNode getNextLeftTupleSinkNode()
          Returns the next node
 LeftTupleSinkNode getPreviousLeftTupleSinkNode()
          Returns the previous node
 LeftTupleSource getStartTupleSource()
           
 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(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 tuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Retracts the corresponding tuple by retrieving and retracting the fact created for it
 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 setStartTupleSource(LeftTupleSource startTupleSource)
           
 String toString()
           
 void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.core.reteoo.ObjectSource
addObjectSink, getDeclaredMask, getObjectTypeNode, getParentObjectSource, getSinkPropagator, initDeclaredMask, isInUse, removeObjectSink, resetInferredMask, updateMask
 
Methods inherited from class org.drools.core.common.BaseNode
addAssociation, attach, collectAncestors, 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
 

Constructor Detail

RightInputAdapterNode

public RightInputAdapterNode()

RightInputAdapterNode

public RightInputAdapterNode(int id,
                             LeftTupleSource source,
                             LeftTupleSource startTupleSource,
                             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

readExternal

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

writeExternal

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

getStartTupleSource

public LeftTupleSource getStartTupleSource()

setStartTupleSource

public void setStartTupleSource(LeftTupleSource startTupleSource)

createMemory

public Memory createMemory(RuleBaseConfiguration config,
                           InternalWorkingMemory wm)
Creates and return the node memory

Specified by:
createMemory in interface MemoryFactory

createPeer

public LeftTuple createPeer(LeftTuple original)
Specified by:
createPeer in interface LeftTupleSink

assertLeftTuple

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

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

createFactHandle

public InternalFactHandle createFactHandle(LeftTuple leftTuple,
                                           PropagationContext context,
                                           InternalWorkingMemory workingMemory)

retractLeftTuple

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

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

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

Overrides:
networkUpdated in class ObjectSource

updateSink

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

doRemove

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

Overrides:
doRemove in class ObjectSource

doCollectAncestors

protected void doCollectAncestors(NodeSet nodeSet)
Overrides:
doCollectAncestors in class ObjectSource

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 NetworkNode
Specified by:
getType in interface LeftTupleSink

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

toString

public String toString()
Overrides:
toString in class BaseNode

createLeftTuple

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

createLeftTuple

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

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 LeftTupleSink sink,
                                 PropagationContext pctx,
                                 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

getLeftTupleSource

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

getLeftInputOtnId

public ObjectTypeNode.Id getLeftInputOtnId()
Specified by:
getLeftInputOtnId in interface LeftTupleSink

setLeftInputOtnId

public void setLeftInputOtnId(ObjectTypeNode.Id leftInputOtnId)
Specified by:
setLeftInputOtnId in interface LeftTupleSink

calculateDeclaredMask

public long calculateDeclaredMask(List<String> settableProperties)
Specified by:
calculateDeclaredMask in class ObjectSource

getLeftInferredMask

public long getLeftInferredMask()
Specified by:
getLeftInferredMask in interface LeftTupleSink

Drools :: Core 6.0.0.Beta5

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