true );
if ( accctx.getAction() == null ) {
// schedule a test to evaluate the constraints, this is an optimisation for sub networks
// We set Source to LEFT, even though this is a right propagation, because it might end up
// doing multiple right propagations anyway
EvaluateResultConstraints action = new EvaluateResultConstraints( ActivitySource.LEFT,
leftTuple,
context,
workingMemory,
memory,
accctx,
true,
this );
accctx.setAction( action );
context.getQueue1().addFirst( action );
}
}
}
} else {
// in the same bucket, so iterate and compare
for ( ; leftTuple != null; leftTuple = (LeftTuple) leftIt.next( leftTuple ) ) {
if ( this.constraints.isAllowedCachedRight( memory.betaMemory.getContext(),
leftTuple ) ) {
final AccumulateContext accctx = (AccumulateContext) leftTuple.getObject();
LeftTuple temp = null;
if ( childLeftTuple != null && childLeftTuple.getLeftParent() == leftTuple ) {
temp = childLeftTuple.getRightParentNext();
// we must re-add this to ensure deterministic iteration
childLeftTuple.reAddLeft();
removeMatch( rightTuple,
childLeftTuple,
workingMemory,
memory,
accctx,
true );
childLeftTuple = temp;
}
// add a new match
addMatch( leftTuple,
rightTuple,
null,
childLeftTuple,
workingMemory,
memory,
accctx,
true );
if ( temp != null ) {
childLeftTuple = temp;
}
if ( accctx.getAction() == null ) {
// schedule a test to evaluate the constraints, this is an optimisation for sub networks
// We set Source to LEFT, even though this is a right propagation, because it might end up
// doing multiple right propagations anyway
EvaluateResultConstraints action = new EvaluateResultConstraints( ActivitySource.LEFT,
leftTuple,
context,
workingMemory,
memory,
accctx,
true,
this );
accctx.setAction( action );
context.getQueue1().addFirst( action );
}
} else if ( childLeftTuple != null && childLeftTuple.getLeftParent() == leftTuple ) {
LeftTuple temp = childLeftTuple.getRightParentNext();
final AccumulateContext accctx = (AccumulateContext)leftTuple.getObject();
// remove the match
removeMatch( rightTuple,
childLeftTuple,
workingMemory,
memory,
accctx,
true );
if ( accctx.getAction() == null ) {
// schedule a test to evaluate the constraints, this is an optimisation for sub networks
// We set Source to LEFT, even though this is a right propagation, because it might end up
// doing multiple right propagations anyway
EvaluateResultConstraints action = new EvaluateResultConstraints( ActivitySource.LEFT,
leftTuple,
context,
workingMemory,
memory,
accctx,