public void remove() { if ( this.immutable ) { throw new UnsupportedOperationException( "This Iterator is immutable, you cannot call remove()" ); } if ( this.currentNode != null ) { this.list.remove( this.currentNode ); this.currentNode = null; } else { throw new IllegalStateException( "No item to remove. Call next() before calling remove()." ); } } }
public void removeScheduleItem(final ScheduledAgendaItem item) { if ( item.getEnqueued().compareAndSet( true, false ) ) { this.scheduledActivations.remove( item ); Scheduler.removeAgendaItem( item, this ); } }
public void removeActivation(final Activation activation) { final ActivationGroupNode node = activation.getActivationGroupNode(); this.list.remove( node ); activation.setActivationGroupNode( null ); }
public void removeActivation(final Activation activation) { final ActivationNode node = activation.getActivationNode(); this.list.remove( node ); activation.setActivationNode( null ); }
this.node2.getNext(), this.node3 ); this.list.remove( this.node2 ); assertNull( "Node2 previous should be null", this.node2.getPrevious() ); this.node1.getNext(), this.node3 ); this.list.remove( this.node1 ); assertNull( "Node1 previous should be null", this.node1.getPrevious() ); assertNull( "Node3 next should be null", this.node3.getNext() ); this.list.remove( this.node3 ); assertNull( "Node3 previous should be null", this.node3.getPrevious() );
private FieldIndex unregisterFieldIndex(final int index) { final FieldIndex fieldIndex = findFieldIndex( index ); fieldIndex.decreaseCounter(); // if the fieldcount is 0 then remove it from the linkedlist if ( fieldIndex.getCount() == 0 ) { this.hashedFieldIndexes.remove( fieldIndex ); // if the linkedlist is empty then null it if ( this.hashedFieldIndexes.isEmpty() ) { this.hashedFieldIndexes = null; } } return fieldIndex; }
for ( dep = this.previousJustified.getFirst(); dep != null; dep = dep.getNext() ) { if ( object.equals( ((InternalFactHandle) dep.getJustified()).getObject() ) ) { this.previousJustified.remove( dep ); break;
public void cancelRemainingPreviousLogicalDependencies() { if ( this.previousJustified != null ) { for ( LogicalDependency dep = (LogicalDependency) this.previousJustified.getFirst(); dep != null; dep = (LogicalDependency) dep.getNext() ) { this.workingMemory.getTruthMaintenanceSystem().removeLogicalDependency( activation, dep, activation.getPropagationContext() ); } } if ( this.previousBlocked != null ) { for ( LogicalDependency dep = this.previousBlocked.getFirst(); dep != null; ) { LogicalDependency tmp = dep.getNext(); this.previousBlocked.remove( dep ); AgendaItem justified = ( AgendaItem ) dep.getJustified(); justified.getBlockers().remove( dep.getJustifierEntry() ); if (justified.getBlockers().isEmpty() ) { // the match is no longer blocked, so stage it ((DefaultAgenda)workingMemory.getAgenda()).getStageActivationsGroup().addActivation( justified ); } dep = tmp; } } }
/** * The FactHandle is being removed from the system so remove any logical dependencies * between the justified FactHandle and its justifiers. Removes the FactHandle key * from the justifiedMap. It then iterates over all the LogicalDependency nodes, if any, * in the returned Set and removes the LogicalDependency node from the LinkedList maintained * by the Activation. * * @see LogicalDependency * * @param handle - The FactHandle to be removed * @throws FactException */ public void removeLogicalDependencies(final InternalFactHandle handle) throws FactException { final BeliefSet beliefSet = (BeliefSet) this.justifiedMap.remove( handle.getId() ); if ( beliefSet != null && !beliefSet.isEmpty() ) { for ( LinkedListEntry entry = (LinkedListEntry) beliefSet.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) { final LogicalDependency node = (LogicalDependency) entry.getObject(); node.getJustifier().getLogicalDependencies().remove( node ); } } }
public void execute(JobContext ctx) { InternalAgenda agenda = ( InternalAgenda ) ((ActivationTimerJobContext)ctx).getAgenda(); ScheduledAgendaItem item = ((ActivationTimerJobContext)ctx).getScheduledAgendaItem(); boolean wasFired = agenda.fireTimedActivation( item, false ); if ( ((ActivationTimerJobContext)ctx).getTrigger().hasNextFireTime() == null ) { if ( wasFired ) { agenda.getWorkingMemory().fireAllRules(); } else { postpone(item, agenda); } if ( item.getEnqueued().compareAndSet( true, false ) ) { agenda.getScheduledActivationsLinkedList().remove( item ); } } else { // the activation has been rescheduled, the Agenda would have set it's activated to false // so reset the activated to true here item.setActivated( true ); if ( wasFired ) { agenda.getWorkingMemory().fireAllRules(); } else { postpone(item, agenda); } } }
public void removeAllBlockersAndBlocked(DefaultAgenda agenda){ if ( this.blockers != null ) { // Iterate and remove this node's logical dependency list from each of it's blockers for ( LinkedListEntry<LogicalDependency> node = blockers.getFirst(); node != null; node = node.getNext() ) { LogicalDependency dep = node.getObject(); dep.getJustifier().getBlocked().remove( dep ); } } this.blockers = null; if ( this.blocked != null ) { // Iterate and remove this node's logical dependency list from each of it's blocked for ( LogicalDependency dep = blocked.getFirst(); dep != null; ) { LogicalDependency tmp = dep.getNext(); removeBlocked( dep ); AgendaItem justified = ( AgendaItem ) dep.getJustified(); if ( justified.getBlockers().isEmpty() && justified.isActivated() ) { // the match is no longer blocked, so stage it agenda.getStageActivationsGroup().addActivation( justified ); } dep = tmp; } } this.blocked = null; }
if ( sitem.getEnqueued().compareAndSet( true, false ) ) { this.scheduledActivations.remove( sitem );
public void blockActivation(org.drools.runtime.rule.Activation act) { AgendaItem targetMatch = ( AgendaItem ) act; // iterate to find previous equal logical insertion LogicalDependency dep = null; if ( this.previousJustified != null ) { for ( dep = this.previousJustified.getFirst(); dep != null; dep = dep.getNext() ) { if ( targetMatch == dep.getJustified() ) { this.previousJustified.remove( dep ); break; } } } if ( dep == null ) { dep = new SimpleLogicalDependency( activation, targetMatch ); } this.activation.addBlocked( dep ); if ( targetMatch.getBlockers().size() == 1 && targetMatch.isActive() ) { // it wasn't blocked before, but is now, so we must remove it from all groups, so it cannot be executed. targetMatch.remove(); if ( targetMatch.getActivationGroupNode() != null ) { targetMatch.getActivationGroupNode().getActivationGroup().removeActivation( targetMatch ); } if ( targetMatch.getActivationNode() != null ) { final InternalRuleFlowGroup ruleFlowGroup = (InternalRuleFlowGroup) targetMatch.getActivationNode().getParentContainer(); ruleFlowGroup.removeActivation( targetMatch ); } } }