MASON-INTEREST-L Archives

September 2011

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:
Sam Brett <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Wed, 21 Sep 2011 16:01:24 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (21 lines)
I am having a problem removing Steppables from the schedule dynamically. I
am stopping them in an extension of the Display2D class which I called
InteractiveDisplay2D where I can remove agents by clicking on the grid. But
I find even when stopping these Steppables that they will linger on the
schedule. For example, I am stopping them by means of:

schedule.scheduleOnce(schedule.getTime(), new Steppable() {
     public void step(SimState state) {
          // Stopping steppables in here
     }
}

I read that if you do a schedule once on the current time that the steppable
will be put on the schedule at the current time plus epsilon. So I thought
this should work as I will have always stopped the Steppables after they
have executed and on the same thread. In that way, there should be no thread
interference. But still I am having this problem. This must have something
to do with the Display2D being on the event dispatch thread separate from
the thread the schedule is operating on. I cannot understand why though,
since I put the removal on the schedule itself.

ATOM RSS1 RSS2