public static void writeRightTuples(InternalFactHandle handle, MarshallerWriteContext context) throws IOException { ObjectOutputStream stream = context.stream; //context.out.println( "RightTuples Start" ); for ( RightTuple rightTuple = handle.getFirstRightTuple(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getHandleNext() ) { stream.writeShort( PersisterEnums.RIGHT_TUPLE ); writeRightTuple( rightTuple, context ); } stream.writeShort( PersisterEnums.END ); //context.out.println( "RightTuples END" ); }
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 modifyLeftTuple(LeftTuple leftTuple, PropagationContext context, InternalWorkingMemory workingMemory) { final RIAMemory memory = (RIAMemory) workingMemory.getNodeMemory( this ); // add it to a memory mapping InternalFactHandle handle = (InternalFactHandle) memory.memory.get( leftTuple ); // propagate it for ( RightTuple rightTuple = handle.getFirstRightTuple(); rightTuple != null; rightTuple = (RightTuple) rightTuple.getHandleNext() ) { rightTuple.getRightTupleSink().modifyRightTuple( rightTuple, context, workingMemory ); } }
context ); matches.put( handle.getObject(), handle.getFirstRightTuple() );
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(); }
for ( RightTuple rightTuple = factHandle.getFirstRightTuple(); rightTuple != null; rightTuple = rightTuple.getHandleNext() ) { rightTuple.getRightTupleSink().retractRightTuple( rightTuple, context,
ModifyPreviousTuples modifyPreviousTuples = new ModifyPreviousTuples(handle.getFirstLeftTuple(), handle.getFirstRightTuple() ); handle.clearLeftTuples(); handle.clearRightTuples();