MASON-INTEREST-L Archives

August 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 28 Aug 2015 15:46:50 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
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

ATOM RSS1 RSS2