站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

JoinNode (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.reteoo
Class JoinNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.TupleSource
          extended by org.drools.reteoo.JoinNode
All Implemented Interfaces:
Serializable, NetworkNode, NodeMemory, ObjectSink, ObjectSinkNode, TupleSink, TupleSinkNode

public class JoinNode
extends TupleSource

JoinNode extends BetaNode to perform ReteTuple and FactHandle joins. Tuples are considered to be asserted from the left input and facts from the right input. The BetaNode provides the BetaMemory to store assserted ReteTuples and FactHandleImpls. Each fact handle is stored in the right memory as a key in a HashMap, the value is an ObjectMatches instance which maintains a LinkedList of TuplesMatches - The tuples that are matched with the handle. the left memory is a LinkedList of ReteTuples which maintains a HashMa, where the keys are the matching FactHandleImpls and the value is populated TupleMatchees, the keys are matched fact handles. TupleMatch maintains a List of resulting joins, where there is joined ReteTuple per TupleSink. The BetaNode provides the BetaMemory which stores the

Author:
Mark Proctor, Bob McWhirter
See Also:
BetaNode, ObjectMatches, TupleMatch, TupleSink, Serialized Form

Field Summary
protected  BetaConstraints constraints
           
protected  TupleSource leftInput
          The left input TupleSource.
protected  ObjectSource rightInput
          The right input TupleSource.
 
Fields inherited from class org.drools.reteoo.TupleSource
sink
 
Fields inherited from class org.drools.common.BaseNode
hasMemory, id, sharedCount
 
Constructor Summary
JoinNode(int id, TupleSource leftInput, ObjectSource rightInput)
          Construct.
JoinNode(int id, TupleSource leftInput, ObjectSource rightInput, BetaConstraints binder)
           
 
Method Summary
 void assertObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new FactHandleImpl.
 void assertTuple(ReteTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new ReteTuple.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 Object createMemory(RuleBaseConfiguration config)
          Creates a BetaMemory for the BetaNode's memory.
 void dumpMemory(InternalWorkingMemory workingMemory)
           
 boolean equals(Object object)
           
 BetaNodeFieldConstraint[] getConstraints()
           
 ObjectSinkNode getNextObjectSinkNode()
          Returns the next node
 TupleSinkNode getNextTupleSinkNode()
          Returns the next node
 ObjectTypeNode getObjectTypeNode()
           
 ObjectSinkNode getPreviousObjectSinkNode()
          Returns the previous node
 TupleSinkNode getPreviousTupleSinkNode()
          Returns the previous node
 List getRules()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 void remove(BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void retractObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          Retract a FactHandleImpl.
 void retractTuple(ReteTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Retract a ReteTuple.
 void setNextObjectSinkNode(ObjectSinkNode next)
          Sets the next node
 void setNextTupleSinkNode(TupleSinkNode next)
          Sets the next node
 void setPreviousObjectSinkNode(ObjectSinkNode previous)
          Sets the previous node
 void setPreviousTupleSinkNode(TupleSinkNode previous)
          Sets the previous node
 String toString()
           
 void updateSink(TupleSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 
Methods inherited from class org.drools.reteoo.TupleSource
addTupleSink, getSinkPropagator, removeTupleSink
 
Methods inherited from class org.drools.common.BaseNode
addShare, getId, getSharedCount, hasMemory, isInUse, isShared, removeShare, setHasMemory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Field Detail

leftInput

protected final TupleSource leftInput
The left input TupleSource.


rightInput

protected final ObjectSource rightInput
The right input TupleSource.


constraints

protected final BetaConstraints constraints
Constructor Detail

JoinNode

public JoinNode(int id,
                TupleSource leftInput,
                ObjectSource rightInput)
Construct.

Parameters:
leftInput - The left input TupleSource.
rightInput - The right input TupleSource.

JoinNode

public JoinNode(int id,
                TupleSource leftInput,
                ObjectSource rightInput,
                BetaConstraints binder)
Method Detail

assertTuple

public void assertTuple(ReteTuple leftTuple,
                        PropagationContext context,
                        InternalWorkingMemory workingMemory)
Assert a new ReteTuple. The right input of FactHandleInput's is iterated and joins attemped, via the binder, any successful bindings results in joined tuples being created and propaged. there is a joined tuple per TupleSink.

Parameters:
tuple - The Tuple being asserted.
context - The PropagationContext
workingMemory - The working memory seesion.
See Also:
ReteTuple, ObjectMatches, TupleSink, TupleMatch

assertObject

public void assertObject(InternalFactHandle handle,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Assert a new FactHandleImpl. The left input of ReteTuples is iterated and joins attemped, via the binder, any successful bindings results in joined tuples being created and propaged. there is a joined tuple per TupleSink.

Parameters:
handle - The FactHandleImpl being asserted.
context - The PropagationContext
workingMemory - The working memory seesion.
See Also:
ReteTuple, ObjectMatches, TupleSink, TupleMatch

retractObject

public void retractObject(InternalFactHandle handle,
                          PropagationContext context,
                          InternalWorkingMemory workingMemory)
Retract a FactHandleImpl. Iterates the referenced TupleMatches stored in the handle's ObjectMatches retracting joined tuples.

Parameters:
handle - the being retracted
context - The PropagationContext
workingMemory - The working memory seesion.

retractTuple

public void retractTuple(ReteTuple leftTuple,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Retract a ReteTuple. Iterates the referenced TupleMatche's stored in the tuples Map retracting all joined tuples.

Parameters:
key - The tuple key.
context - The PropagationContext
workingMemory - The working memory seesion.

updateSink

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

toString

public String toString()

getConstraints

public BetaNodeFieldConstraint[] getConstraints()

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

getRules

public List getRules()

getObjectTypeNode

public ObjectTypeNode getObjectTypeNode()

attach

public void attach(InternalWorkingMemory[] workingMemories)
Specified by:
attach in class BaseNode

remove

public void remove(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

dumpMemory

public void dumpMemory(InternalWorkingMemory workingMemory)

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 Object createMemory(RuleBaseConfiguration config)
Creates a BetaMemory for the BetaNode's memory.

Specified by:
createMemory in interface NodeMemory

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

getNextObjectSinkNode

public ObjectSinkNode getNextObjectSinkNode()
Returns the next node

Specified by:
getNextObjectSinkNode in interface ObjectSinkNode
Returns:
The next ObjectSinkNode

setNextObjectSinkNode

public void setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node

Specified by:
setNextObjectSinkNode in interface ObjectSinkNode
Parameters:
next - The next ObjectSinkNode

getPreviousObjectSinkNode

public ObjectSinkNode getPreviousObjectSinkNode()
Returns the previous node

Specified by:
getPreviousObjectSinkNode in interface ObjectSinkNode
Returns:
The previous ObjectSinkNode

setPreviousObjectSinkNode

public void setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node

Specified by:
setPreviousObjectSinkNode in interface ObjectSinkNode
Parameters:
previous - The previous ObjectSinkNode


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.