Print

Print


Pausing isn't a simulation concept: it's a graphical user interface concept.  That is, if you ran the simulation on the command line minus the GUI, pausing doesn't even exist as a notion.

Probably the easiest thing for you to do is to add a Steppable into your GUIstate's minischedule.  I'd do this in your GUIState.start() method.

GUIState gui = ...;
final GUIState gui2 = gui;

Steppable step = new Steppable()
  {
  public void step(SimState state)
    {
    boolean test = ... ;  // this should be set to true if you wish to pause

    if (test) SwingUtilities.invokeLater(new Runnable()
      {
      public void run()
        {
        (Console)(gui2.controller)).pressPause();
        }
      });
    }
  };

gui.scheduleImmediatelyAfter(step);

Sean

On Aug 28, 2015, at 3:25 PM, Axel Kowald <[log in to unmask]> wrote:

>> There is already a method for killing a simulation.  It's called GUIState.kill(). 
> Okay, and is there also a method for programmatically pausing a simulation ?
> 
> axel