MASON-INTEREST-L Archives

August 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

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

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

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 28 Aug 2015 15:46:50 -0400
MIME-version:
1.0 (Mac OS X Mail 7.3 \(1878.6\))
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=windows-1252
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Message-ID:
Content-Transfer-Encoding:
8bit
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