public void updateInspector() { double time = simulation.state.schedule.time(); // we should only update if we're at a new time that we've not seen yet, or if // we're at the start of inspection and haven't done an update yet. It's possible // for this second condition to be true while the first one is false: if we're at // simulation start, then lastTime == Schedule.BEFORE_SIMULATION == time, but we'd // still want to update at least one time. if (time >= Schedule.EPOCH && time < Schedule.AFTER_SIMULATION && (lastTime < time || !updatedOnceAlready)) // bug fix { updatedOnceAlready = true; updateSeries(time, lastTime); lastTime = time; // now determine when to update switch (globalAttributes.redraw) { case REDRAW_ALWAYS: // do it now generator.update(); break; case REDRAW_TENTH_SEC: updateBefore(100); break; case REDRAW_HALF_SEC: updateBefore(500); break; case REDRAW_ONE_SEC: updateBefore(1000); break; case REDRAW_TWO_SECS: updateBefore(2000); break; case REDRAW_FIVE_SECS: updateBefore(5000); break; case REDRAW_TEN_SECS: updateBefore(10000); break; case REDRAW_DONT: // do nothing break; default: System.err.println("Unknown redraw time specified"); } } }