Esempio n. 1
0
 protected void halt_randomEventsActionPerformed(ActionEvent evt) {
   if (randomEventGen.isRunning()) {
     try {
       randomEventGen.setProbability(Probability.PASSENGER, 0f);
       randomEventGen.setProbability(Probability.FAULT, 0f);
       randomEventGen.setProbability(Probability.EMERGENCY, 0f);
     } catch (ProbabilityOutofBoundsException e) {
       displayError(e.getMessage());
     }
   }
 }
Esempio n. 2
0
  public void setupRandomEvents(float pass_prob, float emerg_prob, float hardware_prob) {
    try {
      randomEventGen.setProbability(Probability.PASSENGER, pass_prob);
      randomEventGen.setProbability(Probability.FAULT, hardware_prob);
      randomEventGen.setProbability(Probability.EMERGENCY, emerg_prob);
      if (!randomEventGen.isRunning()) randomEventGen.start();
      if (controller.isRunning()) {
        randomEventGen.runEvents();
      }

    } catch (ProbabilityOutofBoundsException e) {
      displayError(e.getMessage());
    }
  }