org.drools.reteoo
Class BetaNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.LeftTupleSource
          extended by org.drools.reteoo.BetaNode
All Implemented Interfaces:
Externalizable, Serializable, NetworkNode, NodeMemory, LeftTupleSink, LeftTupleSinkNode, ObjectSink, ObjectSinkNode, RightTupleSink, Sink
Direct Known Subclasses:
AccumulateNode, ExistsNode, JoinNode, NotNode

public abstract class BetaNode
extends LeftTupleSource
implements LeftTupleSinkNode, ObjectSinkNode, RightTupleSink, NodeMemory

BetaNode provides the base abstract class for JoinNode and NotNode. It implements both TupleSink and ObjectSink and as such can receive Tuples and FactHandles. BetaNode uses BetaMemory to store the propagated instances.

See Also:
LeftTupleSource, LeftTupleSink, BetaMemory, Serialized Form

Field Summary
protected  BehaviorManager behavior
           
protected  boolean concurrentRightTupleMemory
           
protected  BetaConstraints constraints
           
protected  LeftTupleSource leftInput
          The left input TupleSource.
protected  boolean lrUnlinkingEnabled
           
protected  boolean objectMemory
           
protected  ObjectSource rightInput
          The right input TupleSource.
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
BetaNode()
           
 
Method Summary
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 Object createMemory(RuleBaseConfiguration config)
          Creates a BetaMemory for the BetaNode's memory.
 RightTuple createRightTuple(InternalFactHandle handle, RightTupleSink sink)
           
protected  void doRemove(RuleRemovalContext context, ReteooBuilder builder, BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void dumpMemory(InternalWorkingMemory workingMemory)
           
 boolean equals(Object object)
           
 Behavior[] getBehaviors()
           
 BetaNodeFieldConstraint[] getConstraints()
           
 RightTuple getFirstRightTuple(LeftTuple leftTuple, RightTupleMemory memory, PropagationContext context, FastIterator it)
           
 LeftTupleSinkNode getNextLeftTupleSinkNode()
          Returns the next node
 ObjectSinkNode getNextObjectSinkNode()
          Returns the next node
 ObjectTypeNode getObjectTypeNode()
           
 LeftTupleSinkNode getPreviousLeftTupleSinkNode()
          Returns the previous node
 ObjectSinkNode getPreviousObjectSinkNode()
          Returns the previous node
 BetaConstraints getRawConstraints()
           
 FastIterator getRightIterator(RightTupleMemory memory)
           
 List<String> getRules()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isConcurrentRightTupleMemory()
           
 boolean isLeftTupleMemoryEnabled()
           
 boolean isObjectMemoryEnabled()
           
protected  boolean leftUnlinked(PropagationContext context, InternalWorkingMemory workingMemory, BetaMemory memory)
           
 void modifyLeftTuple(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, 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)
           
protected  boolean rightUnlinked(PropagationContext context, InternalWorkingMemory workingMemory, BetaMemory memory)
           
 void setConcurrentRightTupleMemory(boolean concurrentRightTupleMemory)
           
 void setLeftTupleMemoryEnabled(boolean tupleMemoryEnabled)
           
 void setNextLeftTupleSinkNode(LeftTupleSinkNode next)
          Sets the next node
 void setNextObjectSinkNode(ObjectSinkNode next)
          Sets the next node
 void setObjectMemoryEnabled(boolean objectMemory)
           
 void setPreviousLeftTupleSinkNode(LeftTupleSinkNode previous)
          Sets the previous node
 void setPreviousObjectSinkNode(ObjectSinkNode previous)
          Sets the previous node
 void setUnificationJoin()
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.reteoo.LeftTupleSource
addTupleSink, getSinkPropagator, isInUse, removeTupleSink, updateSink
 
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.reteoo.LeftTupleSink
assertLeftTuple, getType, modifyLeftTuple, retractLeftTuple
 
Methods inherited from interface org.drools.reteoo.ObjectSink
assertObject
 
Methods inherited from interface org.drools.common.NetworkNode
getId, getPartitionId
 
Methods inherited from interface org.drools.reteoo.RightTupleSink
getType, modifyRightTuple, retractRightTuple
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Field Detail

leftInput

protected LeftTupleSource leftInput
The left input TupleSource.


rightInput

protected ObjectSource rightInput
The right input TupleSource.


constraints

protected BetaConstraints constraints

behavior

protected BehaviorManager behavior

objectMemory

protected boolean objectMemory

tupleMemoryEnabled

protected boolean tupleMemoryEnabled

concurrentRightTupleMemory

protected boolean concurrentRightTupleMemory

lrUnlinkingEnabled

protected boolean lrUnlinkingEnabled
See Also:
LRUnlinkingOption
Constructor Detail

BetaNode

public BetaNode()
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

setUnificationJoin

public void setUnificationJoin()

getRightIterator

public FastIterator getRightIterator(RightTupleMemory memory)

getFirstRightTuple

public RightTuple getFirstRightTuple(LeftTuple leftTuple,
                                     RightTupleMemory memory,
                                     PropagationContext context,
                                     FastIterator it)

getConstraints

public BetaNodeFieldConstraint[] getConstraints()

getRawConstraints

public BetaConstraints getRawConstraints()

getBehaviors

public Behavior[] getBehaviors()

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

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

getRules

public List<String> getRules()

getObjectTypeNode

public ObjectTypeNode getObjectTypeNode()

attach

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

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

modifyObject

public void modifyObject(InternalFactHandle factHandle,
                         ModifyPreviousTuples modifyPreviousTuples,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
Specified by:
modifyObject in interface ObjectSink

modifyLeftTuple

public void modifyLeftTuple(InternalFactHandle factHandle,
                            ModifyPreviousTuples modifyPreviousTuples,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Specified by:
modifyLeftTuple in interface LeftTupleSink

isObjectMemoryEnabled

public boolean isObjectMemoryEnabled()

setObjectMemoryEnabled

public void setObjectMemoryEnabled(boolean objectMemory)

isLeftTupleMemoryEnabled

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

setLeftTupleMemoryEnabled

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

isConcurrentRightTupleMemory

public boolean isConcurrentRightTupleMemory()

setConcurrentRightTupleMemory

public void setConcurrentRightTupleMemory(boolean concurrentRightTupleMemory)

toString

public String toString()
Overrides:
toString 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

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

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

createRightTuple

public RightTuple createRightTuple(InternalFactHandle handle,
                                   RightTupleSink sink)

leftUnlinked

protected boolean leftUnlinked(PropagationContext context,
                               InternalWorkingMemory workingMemory,
                               BetaMemory memory)

rightUnlinked

protected boolean rightUnlinked(PropagationContext context,
                                InternalWorkingMemory workingMemory,
                                BetaMemory memory)


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