Drools :: Core 6.0.0.Beta5

org.drools.core.reteoo
Class AccumulateNode

java.lang.Object
  extended by org.drools.core.common.BaseNode
      extended by org.drools.core.reteoo.LeftTupleSource
          extended by org.drools.core.reteoo.BetaNode
              extended by org.drools.core.reteoo.AccumulateNode
All Implemented Interfaces:
Externalizable, Serializable, MemoryFactory, NetworkNode, LeftTupleSink, LeftTupleSinkNode, ObjectSink, ObjectSinkNode, RightTupleSink, Sink

public class AccumulateNode
extends BetaNode

AccumulateNode A beta node capable of doing accumulate logic. Created: 04/06/2006

Version:
$Id$
See Also:
Serialized Form

Nested Class Summary
static class AccumulateNode.AccumulateContext
           
static class AccumulateNode.AccumulateMemory
           
static class AccumulateNode.ActivitySource
           
 
Field Summary
 
Fields inherited from class org.drools.core.reteoo.BetaNode
concurrentRightTupleMemory, constraints, indexedUnificationJoin, log, objectMemory, rightInput, tupleMemoryEnabled
 
Fields inherited from class org.drools.core.reteoo.LeftTupleSource
leftInput, sink
 
Fields inherited from class org.drools.core.common.BaseNode
associations, id, partitionId, partitionsEnabled, streamMode
 
Constructor Summary
AccumulateNode()
           
AccumulateNode(int id, LeftTupleSource leftInput, ObjectSource rightInput, AlphaNodeFieldConstraint[] resultConstraints, BetaConstraints sourceBinder, BetaConstraints resultBinder, Accumulate accumulate, boolean unwrapRightObject, BuildContext context)
           
 
Method Summary
 void assertLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new ReteTuple.
 void assertRightTuple(RightTuple rightTuple, 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 a BetaMemory for the BetaNode's memory.
 LeftTuple createPeer(LeftTuple original)
           
 InternalFactHandle createResultFactHandle(PropagationContext context, InternalWorkingMemory workingMemory, LeftTuple leftTuple, Object result)
           
protected  void doRemove(InternalWorkingMemory workingMemory, AccumulateNode.AccumulateMemory memory)
           
 boolean equals(Object object)
           
 void evaluateResultConstraints(AccumulateNode.ActivitySource source, LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory, AccumulateNode.AccumulateMemory memory, AccumulateNode.AccumulateContext accctx, boolean useLeftMemory)
          Evaluate result constraints and propagate assert in case they are true
 Accumulate getAccumulate()
           
 LeftTuple getFirstMatch(LeftTuple leftTuple, AccumulateNode.AccumulateContext accctx, boolean isUpdatingSink)
          Skips the propagated tuple handles and return the first handle in the list that correspond to a match
 BetaConstraints getResultBinder()
           
 AlphaNodeFieldConstraint[] getResultConstraints()
           
 short getType()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean isUnwrapRightObject()
           
 void modifyLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void modifyRightTuple(RightTuple rightTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void readExternal(ObjectInput in)
           
 void retractLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void retractRightTuple(RightTuple rightTuple, PropagationContext pctx, InternalWorkingMemory workingMemory)
           
protected  LeftTuple[] splitList(LeftTuple parent, AccumulateNode.AccumulateContext accctx, boolean isUpdatingSink)
           
 void updateSink(LeftTupleSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.drools.core.reteoo.BetaNode
assertObject, attach, byPassModifyToBetaNode, createRightTuple, doCollectAncestors, doDeleteRightTuple, doRemove, doUpdateRightTuple, dumpMemory, getBetaMemory, getBetaMemoryFromRightInput, getConstraints, getFirstLeftTuple, getFirstLeftTuple, getFirstRightTuple, getFirstRightTuple, getLeftIterator, getLeftTupleSource, getNextLeftTupleSinkNode, getNextObjectSinkNode, getObjectTypeNode, getPreviousLeftTupleSinkNode, getPreviousObjectSinkNode, getRawConstraints, getRightDeclaredMask, getRightInferredMask, getRightInput, getRightInputOtnId, getRightIterator, getRightIterator, getRightNegativeMask, getRules, initDeclaredMask, initInferredMask, initInferredMask, isConcurrentRightTupleMemory, isIndexedUnificationJoin, isLeftTupleMemoryEnabled, isObjectMemoryEnabled, isRightInputIsRiaNode, isUnlinkingEnabled, modifyObject, networkUpdated, setConcurrentRightTupleMemory, setConstraints, setLeftListenedProperties, setLeftTupleMemoryEnabled, setNextLeftTupleSinkNode, setNextObjectSinkNode, setObjectMemoryEnabled, setPreviousLeftTupleSinkNode, setPreviousObjectSinkNode, setRightDeclaredMask, setRightInputOtnId, setUnificationJoin, setUnlinkingEnabled, toString, unwrapRightInput
 
Methods inherited from class org.drools.core.reteoo.LeftTupleSource
addTupleSink, addTupleSink, addTupleSink, doModifyLeftTuple, getLeftDeclaredMask, getLeftInferredMask, getLeftInputOtnId, getLeftNegativeMask, getObjectType, getSinkPropagator, initMasks, isInUse, modifyLeftTuple, removeTupleSink, setLeftInferredMask, setLeftInputOtnId, setLeftTupleSource
 
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.reteoo.LeftTupleSink
getLeftInferredMask, getLeftInputOtnId, modifyLeftTuple, setLeftInputOtnId
 
Methods inherited from interface org.drools.core.common.NetworkNode
getAssociations, getId, getPartitionId
 
Methods inherited from interface org.drools.core.common.MemoryFactory
getId
 

Constructor Detail

AccumulateNode

public AccumulateNode()

AccumulateNode

public AccumulateNode(int id,
                      LeftTupleSource leftInput,
                      ObjectSource rightInput,
                      AlphaNodeFieldConstraint[] resultConstraints,
                      BetaConstraints sourceBinder,
                      BetaConstraints resultBinder,
                      Accumulate accumulate,
                      boolean unwrapRightObject,
                      BuildContext context)
Method Detail

readExternal

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

writeExternal

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

getAccumulate

public Accumulate getAccumulate()

getResultConstraints

public AlphaNodeFieldConstraint[] getResultConstraints()

getResultBinder

public BetaConstraints getResultBinder()

isUnwrapRightObject

public boolean isUnwrapRightObject()

assertLeftTuple

public void assertLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)
Description copied from interface: LeftTupleSink
Assert a new ReteTuple.

Parameters:
leftTuple - The ReteTuple to propagate.
context - The PropagationContext of the WorkingMemory action
workingMemory - the WorkingMemory session.

retractLeftTuple

public void retractLeftTuple(LeftTuple leftTuple,
                             PropagationContext context,
                             InternalWorkingMemory workingMemory)

assertRightTuple

public void assertRightTuple(RightTuple rightTuple,
                             PropagationContext context,
                             InternalWorkingMemory workingMemory)
Specified by:
assertRightTuple in class BetaNode

retractRightTuple

public void retractRightTuple(RightTuple rightTuple,
                              PropagationContext pctx,
                              InternalWorkingMemory workingMemory)

modifyLeftTuple

public void modifyLeftTuple(LeftTuple leftTuple,
                            PropagationContext context,
                            InternalWorkingMemory workingMemory)

modifyRightTuple

public void modifyRightTuple(RightTuple rightTuple,
                             PropagationContext context,
                             InternalWorkingMemory workingMemory)

evaluateResultConstraints

public void evaluateResultConstraints(AccumulateNode.ActivitySource source,
                                      LeftTuple leftTuple,
                                      PropagationContext context,
                                      InternalWorkingMemory workingMemory,
                                      AccumulateNode.AccumulateMemory memory,
                                      AccumulateNode.AccumulateContext accctx,
                                      boolean useLeftMemory)
Evaluate result constraints and propagate assert in case they are true


createResultFactHandle

public InternalFactHandle createResultFactHandle(PropagationContext context,
                                                 InternalWorkingMemory workingMemory,
                                                 LeftTuple leftTuple,
                                                 Object result)

updateSink

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

doRemove

protected void doRemove(InternalWorkingMemory workingMemory,
                        AccumulateNode.AccumulateMemory memory)

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 BetaNode

equals

public boolean equals(Object object)
Overrides:
equals in class BetaNode

createMemory

public Memory createMemory(RuleBaseConfiguration config,
                           InternalWorkingMemory wm)
Creates a BetaMemory for the BetaNode's memory.

Specified by:
createMemory in interface MemoryFactory
Overrides:
createMemory in class BetaNode

createPeer

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

getType

public short getType()
Specified by:
getType in interface NetworkNode
Specified by:
getType in interface LeftTupleSink
Specified by:
getType in interface RightTupleSink
Specified by:
getType in class LeftTupleSource

splitList

protected LeftTuple[] splitList(LeftTuple parent,
                                AccumulateNode.AccumulateContext accctx,
                                boolean isUpdatingSink)

getFirstMatch

public LeftTuple getFirstMatch(LeftTuple leftTuple,
                               AccumulateNode.AccumulateContext accctx,
                               boolean isUpdatingSink)
Skips the propagated tuple handles and return the first handle in the list that correspond to a match

Parameters:
leftTuple -
accctx -
Returns:

createLeftTuple

public LeftTuple createLeftTuple(InternalFactHandle factHandle,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)

createLeftTuple

public LeftTuple createLeftTuple(InternalFactHandle factHandle,
                                 LeftTuple leftTuple,
                                 LeftTupleSink sink)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 LeftTupleSink sink,
                                 PropagationContext pctx,
                                 boolean leftTupleMemoryEnabled)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTupleSink sink)

createLeftTuple

public LeftTuple createLeftTuple(LeftTuple leftTuple,
                                 RightTuple rightTuple,
                                 LeftTuple currentLeftChild,
                                 LeftTuple currentRightChild,
                                 LeftTupleSink sink,
                                 boolean leftTupleMemoryEnabled)

Drools :: Core 6.0.0.Beta5

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