extension/src/main/java/org/justinnk/masonssa/extension/ssa/NextReactionMethod.java
/**
   * Reschedule an action because it is affected by the action trigger. Draw a new random number
   * only if the action to reschedule is the trigger.
   *
   * @param action The action to reschedule.
   * @param trigger The action that triggered the rescheduling.
   */
Reschedule an action because it is affected by the action trigger. Draw a new random number
only if the action to reschedule is the trigger.

@param action The action to reschedule.
@param trigger The action that triggered the rescheduling.
Reschedule an action because it is affected by the action trigger . Draw a new random number only if the action to reschedule is the trigger . @param action The action to reschedule . @param trigger The action that triggered the rescheduling .
public void rescheduleAction(Action action, Action trigger) {
    if (action.evaluateCondition()) {
      /* Rescue the old rate and calculate the new rate. */
      double oldRate = action.getCurrentRate();
      double rate = action.calculateRate();
      if (rate > 0) {
        /* Prepare the step that will be scheduled. */
        double currentTime = state.schedule.getTime();
        TentativeStep step =
            new TentativeStep(
                new Steppable() {
                  private static final long serialVersionUID = 1L;
                  @Override
                  public void step(SimState state) {
                    executeAction(action);
                  }
                });
        /*
         * Is the current action the trigger of the rescheduling OR was this action not
         * applicable during initialisation?
         */
        if ((trigger.equals(action)) || action.getCurrentTimestamp() == Double.NEGATIVE_INFINITY) {
          /* If yes, draw new random number */
          double waitingTime = expDist(rate);
          state.schedule.scheduleOnceIn(waitingTime, step);
          action.resetNextEvent(step, currentTime + waitingTime);
        } else {
          /* Otherwise update waiting time */
          /*
           * Note: oldTimestamp will always be NEGATIVE_INFINITY if oldRate is 0, because
           * of stopNextEvent.
           */
          double waitingTime = (oldRate / rate) * (action.getCurrentTimestamp() - currentTime);
          state.schedule.scheduleOnceIn(waitingTime, step);
          action.resetNextEvent(step, currentTime + waitingTime);
        }
      } else {
        action.stopNextEvent();
      }
    } else {
      action.stopNextEvent();
    }
  }
public void rescheduleAction ( Action action , Action trigger ) { if ( action . evaluateCondition ( ) ) { /* Rescue the old rate and calculate the new rate. */ double oldRate = action . getCurrentRate ( ) ; double rate = action . calculateRate ( ) ; if ( rate > 0 ) { /* Prepare the step that will be scheduled. */ double currentTime = state . schedule . getTime ( ) ; TentativeStep step = new TentativeStep ( new Steppable ( ) { private static final long serialVersionUID = 1L ; @ Override public void step ( SimState state ) { executeAction ( action ) ; } } ) ; /*
         * Is the current action the trigger of the rescheduling OR was this action not
         * applicable during initialisation?
         */ if ( ( trigger . equals ( action ) ) || action . getCurrentTimestamp ( ) == Double . NEGATIVE_INFINITY ) { /* If yes, draw new random number */ double waitingTime = expDist ( rate ) ; state . schedule . scheduleOnceIn ( waitingTime , step ) ; action . resetNextEvent ( step , currentTime + waitingTime ) ; } else { /* Otherwise update waiting time */ /*
           * Note: oldTimestamp will always be NEGATIVE_INFINITY if oldRate is 0, because
           * of stopNextEvent.
           */ double waitingTime = ( oldRate / rate ) * ( action . getCurrentTimestamp ( ) - currentTime ) ; state . schedule . scheduleOnceIn ( waitingTime , step ) ; action . resetNextEvent ( step , currentTime + waitingTime ) ; } } else { action . stopNextEvent ( ) ; } } else { action . stopNextEvent ( ) ; } }
Reschedule an action because it is affected by the action trigger.
Reschedule an action because it is affected by the action trigger .
//		assert (trigger != null); //					double waitingTime = expDist(rate);