Example #1
0
  public void clearAndCancel() {
    // Cancel all items and fire a Cancelled event for each Activation
    for (InternalAgendaGroup internalAgendaGroup : this.agendaGroups.values()) {
      clearAndCancelAgendaGroup(internalAgendaGroup);
    }

    final EventSupport eventsupport = (EventSupport) this.workingMemory;
    if (!this.scheduledActivations.isEmpty()) {
      for (ScheduledAgendaItem item = this.scheduledActivations.removeFirst();
          item != null;
          item = this.scheduledActivations.removeFirst()) {
        item.setEnqueued(false);
        Scheduler.removeAgendaItem(item, this);
        eventsupport
            .getAgendaEventSupport()
            .fireActivationCancelled(item, this.workingMemory, MatchCancelledCause.CLEAR);
      }
    }

    // cancel all staged activations
    clearAndCancelStagedActivations();

    // cancel all activation groups.
    for (InternalActivationGroup group : this.activationGroups.values()) {
      clearAndCancelActivationGroup(group);
    }
  }
Example #2
0
 public void removeScheduleItem(final ScheduledAgendaItem item) {
   if (item.isEnqueued()) {
     this.scheduledActivations.remove(item);
     item.setEnqueued(false);
     Scheduler.removeAgendaItem(item, this);
   }
 }
Example #3
0
  public void clear() {
    // reset focus stack
    this.focusStack.clear();
    this.focusStack.add(getMainAgendaGroup());

    // reset scheduled activations
    if (!this.scheduledActivations.isEmpty()) {
      for (ScheduledAgendaItem item = this.scheduledActivations.removeFirst();
          item != null;
          item = this.scheduledActivations.removeFirst()) {
        item.setEnqueued(false);
        Scheduler.removeAgendaItem(item, this);
      }
    }

    // reset staged activations
    getStageActivationsGroup().clear();

    // reset all agenda groups
    for (InternalAgendaGroup group : this.agendaGroups.values()) {
      group.reset();
    }

    // reset all activation groups.
    for (InternalActivationGroup group : this.activationGroups.values()) {
      group.setTriggeredForRecency(this.workingMemory.getFactHandleFactory().getRecency());
      group.reset();
    }
  }