public void modifyQuery(final InternalFactHandle factHandle, final PropagationContext context, final InternalWorkingMemory workingMemory) { if ( queryNode == null ) { this.queryNode = objectTypeNodes.get( ClassObjectType.DroolsQuery_ObjectType ); } if ( queryNode != null ) { ModifyPreviousTuples modifyPreviousTuples = new ModifyPreviousTuples(factHandle.getFirstLeftTuple(), factHandle.getFirstRightTuple() ); factHandle.clearLeftTuples(); factHandle.clearRightTuples(); // There may be no queries defined this.queryNode.modifyObject( factHandle, modifyPreviousTuples, context, workingMemory ); modifyPreviousTuples.retractTuples( context, workingMemory ); } }
public void modifyActivation(final InternalFactHandle factHandle, final PropagationContext context, final InternalWorkingMemory workingMemory) { if ( activationNode == null ) { this.activationNode = objectTypeNodes.get( ClassObjectType.Activation_ObjectType ); } if ( activationNode != null ) { ModifyPreviousTuples modifyPreviousTuples = new ModifyPreviousTuples(factHandle.getFirstLeftTuple(), factHandle.getFirstRightTuple() ); factHandle.clearLeftTuples(); factHandle.clearRightTuples(); // There may be no queries defined this.activationNode.modifyObject( factHandle, modifyPreviousTuples, context, workingMemory ); modifyPreviousTuples.retractTuples( context, workingMemory ); } }
public void execute( final ObjectSinkPropagator sink, final InternalWorkingMemory workingMemory ) { super.execute( sink, workingMemory ); for ( RightTuple rightTuple = this.handle.getFirstRightTuple(); rightTuple != null; rightTuple = rightTuple.getHandleNext() ) { rightTuple.getRightTupleSink().retractRightTuple( rightTuple, context, workingMemory ); } this.handle.clearRightTuples(); for ( LeftTuple leftTuple = this.handle.getLastLeftTuple(); leftTuple != null; leftTuple = leftTuple.getLeftParentNext() ) { leftTuple.getLeftTupleSink().retractLeftTuple( leftTuple, context, workingMemory ); } this.handle.clearLeftTuples(); context.evaluateActionQueue( workingMemory ); } }
/** * Retracts the corresponding tuple by retrieving and retracting * the fact created for it */ public void retractLeftTuple(final LeftTuple tuple, final PropagationContext context, final InternalWorkingMemory workingMemory) { final RIAMemory memory = (RIAMemory) workingMemory.getNodeMemory( this ); // retrieve handle from memory final InternalFactHandle factHandle = (InternalFactHandle) memory.memory.remove( tuple ); for ( RightTuple rightTuple = factHandle.getFirstRightTuple(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getHandleNext() ) { rightTuple.getRightTupleSink().retractRightTuple( rightTuple, context, workingMemory ); } factHandle.clearRightTuples(); for ( LeftTuple leftTuple = factHandle.getLastLeftTuple(); leftTuple != null; leftTuple = (LeftTuple) leftTuple.getLeftParentNext() ) { leftTuple.getLeftTupleSink().retractLeftTuple( leftTuple, context, workingMemory ); } factHandle.clearLeftTuples(); }
workingMemory ); factHandle.clearLeftTuples();
handle.clearLeftTuples(); handle.clearRightTuples();