/**
  * Performs necessary calculations that need to update the user interface after environment
  * variables have changed
  */
 public static void settingsChanged() {
   if (ui == null) { // if we don't have a user interface reference
     ui = new UserInterface(); // make one.
     return;
   }
   reset();
   ui.clearJunctionCache();
   ui.updateGUI();
   if (paused == true) { // if we were paused beforehand
     paused = false; // we are not paused anymore
   }
 }
  /** Resets the simulation to default values. */
  public static void reset() {

    // cannot stop until the current step
    // and rendering is complete
    synchronized (ui) {
      IJunction jn = (IJunction) getOption(JUNCTION_TYPE);
      jn.removeVehicles();
      totalTimeSteps = (int) settings.get(TIME_STEP);
      setOption(TIME_STEP, 0);
      started = false;
      paused = false;
      ui.clearJunctionCache();
      ui.updateGUI();
    }
  }