swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: control panel problem


From: Charles Staelin
Subject: RE: control panel problem
Date: Wed, 19 Apr 2000 09:59:13 -0400

Marcus,

Thank you for your clarification.

Here's a variation of the checkForDone method that seems to
do what I'd like, hopefully without doing any serious
damage.  When modelSwarm signals that it is done by setting
simulationFinished, checkForDone both terminates and  drops
the modelSwarm activity (is there any reason not to just
drop?).  Then, if the user does press START or NEXT, and
checkForDone is entered again, it sees that there is no
modelSwarm activity and it forces a QUIT.

If there were intervening activities, this would presumably
need to be split into two methods, one the first in the
queue, the other last.

Charles

----------------

    public void checkForDone()
    {
        System.out.println("checkForDone " +
                           Globals.env.getCurrentTime());

        if (modelSwarm.getActivity() == null)
            {
            System.out.println("I said to QUIT!");
            getControlPanel().setStateQuit();
            }
        else if (simulationFinished)
            {
            System.out.println("simulationFinished "
                               + Globals.env.getCurrentTime());
            (modelSwarm.getActivity()).terminate();
            (modelSwarm.getActivity()).drop();

            System.out.println("Press QUIT when ready.");
            getControlPanel().setStateStopped();
            }
    }

-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Marcus
G. Daniels
Sent: Tuesday, April 18, 2000 9:21 PM
To: address@hidden
Subject: Re: control panel problem


>>>>> "CS" == Charles Staelin <address@hidden> writes:

CS> If I am on the right track here, then I still am puzzled
at why
CS> the setStateStopped seems to work immediately in
buildObjects.

ControlPanel behaves differently depending on whether or not
there is
a current activity.  In buildObjects, there isn't yet an
activity
running, and so it waits until the state is something other
than
stopped.  In your checkForDone, there will be a current
activity, thus
it has something to stop, and does so (then returns, and
continues
executing code in the caller).  From there on it's up to the
ControlPanel
to restart things.

CS> (Using setStateQuit instead of
CS> Stop clears the probe and raster windows and therefore
is not a
CS> good option here.)  That first activity would be the
first message
CS> inserted in the first schedule of the top-level swarm?

Yeah, as things are, you're probably stuck with a solution
like that.


                  ==================================
   Swarm-Support is for discussion of the technical details
of the day
   to day usage of Swarm.  For list administration needs
(esp.
   [un]subscribing), please send a message to
<address@hidden>
   with "help" in the body of the message.



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]