public void updateSinkOnAttach( BuildContext context, InternalWorkingMemory workingMemory ) { final PropagationContext propagationContext = new PropagationContextImpl(workingMemory.getNextPropagationIdCounter(), PropagationContext.RULE_ADDITION, null, null, null); this.updateSinkOnAttach( context, propagationContext, workingMemory ); propagationContext.evaluateActionQueue( workingMemory ); }
public void execute(InternalWorkingMemory workingMemory) { final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.ASSERTION, this.ruleOrigin, this.leftTuple, this.factHandle ); ReteooRuleBase ruleBase = (ReteooRuleBase) workingMemory.getRuleBase(); ruleBase.assertObject( this.factHandle, this.factHandle.getObject(), context, workingMemory ); context.evaluateActionQueue( workingMemory ); }
private void updatePropagations( BaseNode baseTerminalNode, BuildContext context ) { baseTerminalNode.networkUpdated( new UpdateContext() ); for ( InternalWorkingMemory workingMemory : context.getWorkingMemories() ) { final PropagationContext propagationContext = new PropagationContextImpl(workingMemory.getNextPropagationIdCounter(), PropagationContext.RULE_ADDITION, null, null, null); for ( BaseNode node : context.getNodes() ) { node.updateSinkOnAttach( context, propagationContext, workingMemory ); } propagationContext.evaluateActionQueue( workingMemory ); } }
if( handle.isValid() ) { final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.EXPIRATION, null,
public void build(BuildContext context, BuildUtils utils, RuleConditionElement rce) { NamedConsequence namedConsequence = (NamedConsequence) rce; RuleTerminalNode terminalNode = buildTerminalNodeForNamedConsequence(context, namedConsequence); terminalNode.attach(context); terminalNode.networkUpdated(new UpdateContext()); // adds the terminal node to the list of nodes created/added by this sub-rule context.addNode(terminalNode); for ( InternalWorkingMemory workingMemory : context.getWorkingMemories() ) { final PropagationContext propagationContext = new PropagationContextImpl(workingMemory.getNextPropagationIdCounter(), PropagationContext.RULE_ADDITION, null, null, null); for ( BaseNode node : context.getNodes() ) { node.updateSinkOnAttach( context, propagationContext, workingMemory ); } propagationContext.evaluateActionQueue( workingMemory ); } }
final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.EXPIRATION, null,
public void execute(InternalWorkingMemory workingMemory) { if ( this.factHandle.isValid() ) { EventFactHandle eventHandle = (EventFactHandle) factHandle; if ( eventHandle.hasPendingActions() ) { workingMemory.queueWorkingMemoryAction( this ); return; } // if the fact is still in the working memory (since it may have been previously retracted already final PropagationContext context = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.EXPIRATION, null, null, this.factHandle ); eventHandle.setExpired( true ); this.node.retractObject( factHandle, context, workingMemory ); context.evaluateActionQueue( workingMemory ); // if no activations for this expired event if ( eventHandle.getActivationsCount() == 0 ) { // remove it from the object store and clean up resources eventHandle.getEntryPoint().retract( factHandle ); } context.evaluateActionQueue( workingMemory ); } }
public void cleanUp(final LeftTuple leftTuple, final InternalWorkingMemory workingMemory) { if ( leftTuple.getLeftTupleSink() != node ) { return; } final Activation activation = (Activation) leftTuple.getObject(); // this is to catch a race condition as activations are activated and unactivated on timers if ( activation instanceof ScheduledAgendaItem ) { ScheduledAgendaItem scheduled = (ScheduledAgendaItem) activation; workingMemory.getTimerService().removeJob( scheduled.getJobHandle() ); scheduled.getJobHandle().setCancel( true ); } if ( activation.isActivated() ) { activation.remove(); ((EventSupport) workingMemory).getAgendaEventSupport().fireActivationCancelled( activation, workingMemory, ActivationCancelledCause.CLEAR ); } final PropagationContext propagationContext = new PropagationContextImpl( workingMemory.getNextPropagationIdCounter(), PropagationContext.RULE_REMOVAL, null, null, null ); workingMemory.getTruthMaintenanceSystem().removeLogicalDependencies( activation, propagationContext, node.getRule() ); leftTuple.unlinkFromLeftParent(); leftTuple.unlinkFromRightParent(); } }
private static void assertHandleIntoOTN(MarshallerReaderContext context, InternalWorkingMemory wm, InternalFactHandle handle) { Object object = handle.getObject(); InternalWorkingMemoryEntryPoint ep = (InternalWorkingMemoryEntryPoint) handle.getEntryPoint(); ObjectTypeConf typeConf = ((InternalWorkingMemoryEntryPoint) handle.getEntryPoint()).getObjectTypeConfigurationRegistry().getObjectTypeConf( ep.getEntryPoint(), object ); PropagationContextImpl propagationContext = new PropagationContextImpl( wm.getNextPropagationIdCounter(), PropagationContext.ASSERTION, null, null, handle, ((DefaultAgenda) wm.getAgenda()).getActiveActivations(), ((DefaultAgenda) wm.getAgenda()).getDormantActivations(), ep.getEntryPoint(), context); ep.getEntryPointNode().assertObject( handle, propagationContext, typeConf, wm ); propagationContext.evaluateActionQueue( wm ); wm.executeQueuedActions(); propagationContext.cleanReaderContext(); }
workingMemory.getNextPropagationIdCounter(), org.drools.runtime.rule.PropagationContext.RETRACTION, (Rule) context.getRule(),