LeftTupleSets srcLeftTuples,
LeftTupleSets trgLeftTuples) {
boolean tupleMemory = true;
boolean tupleMemoryEnabled = true;
Accumulate accumulate = accNode.getAccumulate();
BetaMemory bm = am.getBetaMemory();
LeftTupleMemory ltm = bm.getLeftTupleMemory();
RightTupleMemory rtm = bm.getRightTupleMemory();
ContextEntry[] contextEntry = bm.getContext();
BetaConstraints constraints = accNode.getRawConstraints();
FastIterator it = accNode.getRightIterator( rtm );
for ( LeftTuple leftTuple = srcLeftTuples.getInsertFirst(); leftTuple != null; ) {
LeftTuple next = leftTuple.getStagedNext();
PropagationContext context = leftTuple.getPropagationContext();
AccumulateContext accresult = new AccumulateContext();
boolean useLeftMemory = true;
if ( !tupleMemoryEnabled ) {
// This is a hack, to not add closed DroolsQuery objects
Object object = ((InternalFactHandle) leftTuple.get( 0 )).getObject();
if ( !(object instanceof DroolsQuery) || !((DroolsQuery) object).isOpen() ) {
useLeftMemory = false;
}
}
if ( useLeftMemory ) {
ltm.add( leftTuple );
leftTuple.setObject( accresult );
}
accresult.context = accumulate.createContext();
accumulate.init( am.workingMemoryContext,
accresult.context,
leftTuple,
wm );
constraints.updateFromTuple( contextEntry,