[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Two actions at one time in schedule breaks next
From: |
Marcus G. Daniels |
Subject: |
Re: Two actions at one time in schedule breaks next |
Date: |
27 Nov 2000 19:46:09 -0800 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
TTF> how do I get the time of the swarm.activity.ActionToImpl and
TTF> ActionConcurrent_c instances?
Here's an example. You'll need to update your DLLs and swarm.jar file.
[This is *not* to say that I think these new two new features
(ActionConcurrent and the new getKeyValue method in MapIndex) should
be used for anything but debugging purposes...]
import swarm.activity.ScheduleImpl;
import swarm.activity.Action;
import swarm.activity.ActionConcurrent;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.activity.Schedule;
import swarm.objectbase.SwarmImpl;
import swarm.defobj.Zone;
import swarm.collections.Index;
import swarm.collections.MapIndex;
import swarm.Selector;
import swarm.Globals;
public class TestMapIndexInspect extends SwarmImpl {
public static void main (String[] args) {
Globals.env.initSwarm("TestMapIndexInspect", "0.0", "address@hidden", args);
try {
TestMapIndexInspect obj = new TestMapIndexInspect
(Globals.env.globalZone);
obj.buildActions ();
obj.test ();
}
catch (NoClassDefFoundError e) {
e.printStackTrace();
}
}
Schedule schedule;
public TestMapIndexInspect (Zone aZone) {
super (aZone);
}
public void message1 () {
System.out.println ("message1");
}
public void message2 () {
System.out.println ("message2");
}
public void message3 () {
System.out.println ("message3");
}
public Object buildActions () {
schedule = new ScheduleImpl (Globals.env.globalZone, true);
try {
Selector sel1 = new Selector (getClass (), "message1", false);
Selector sel2 = new Selector (getClass (), "message2", false);
Selector sel3 = new Selector (getClass (), "message3", false);
schedule.at$createActionTo$message (1, this, sel1);
schedule.at$createActionTo$message (2, this, sel2);
schedule.at$createActionTo$message (2, this, sel3);
} catch (Exception e) {
e.printStackTrace (System.err);
System.exit (1);
}
return this;
}
public void test () {
MapIndex scheduleIndex = schedule.mapBegin (getZone ());
Action action;
action = (Action) scheduleIndex.next ();
System.out.println (scheduleIndex.getKeyValue () + " action: " + action);
Index index = (((ActionConcurrent) scheduleIndex.next
()).getConcurrentGroup ()).begin (getZone ());
System.out.println (index.next ());
System.out.println (index.next ());
System.out.println (index.next ());
System.out.println (scheduleIndex.getKeyValue () + " action: " + action);
action = (Action) scheduleIndex.next ();
System.out.println (scheduleIndex.getKeyValue () + " action: " + action);
}
}
==================================
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.
- RE: Two actions at one time in schedule breaks next, (continued)
- RE: Two actions at one time in schedule breaks next, Steve Brophy, 2000/11/20
- RE: Two actions at one time in schedule breaks next, Steve Brophy, 2000/11/20
- RE: Two actions at one time in schedule breaks next, Tee Toth-Fejel, 2000/11/21
- RE: Two actions at one time in schedule breaks next, Steve Brophy, 2000/11/22
- RE: Two actions at one time in schedule breaks next, Tee Toth-Fejel, 2000/11/27
- RE: Two actions at one time in schedule breaks next, Tee Toth-Fejel, 2000/11/28