import swarm.objectbase.SwarmImpl; import swarm.defobj.Zone; import swarm.activity.Schedule; import swarm.activity.ScheduleImpl; import swarm.objectbase.Swarm; import swarm.activity.Activity; import swarm.defobj.FCallImpl; import swarm.defobj.FCall; import swarm.defobj.FArgumentsImpl; import swarm.defobj.FArgumentsCImpl; import swarm.defobj.FArguments; import swarm.defobj.FArgumentsC; import swarm.Selector; import swarm.Globals; public class TestFActionArgs extends SwarmImpl { TestFActionArgs (Zone aZone) { super (aZone); } Schedule schedule; Schedule stopSchedule; public void stepArg (float val) { System.out.println ("next @ " + Globals.env.getCurrentTime () + " val: " + val); } public void end () { getActivity ().terminate (); } FCall createCall () { try { Selector sel = new Selector (getClass (), "stepArg", false); FArgumentsC creating = new FArgumentsCImpl (new FArgumentsImpl ()); creating.createBegin (getZone ()); creating.setSelector (sel); creating.addDouble (2.5); return new FCallImpl (getZone (), this, sel, (FArguments) creating.createEnd ()); } catch (Exception e) { e.printStackTrace (System.err); } return null; } FCall createStopCall () { try { Selector sel = new Selector (getClass (), "end", false); return new FCallImpl (getZone (), this, sel, new FArgumentsImpl (getZone (), sel)); } catch (Exception e) { e.printStackTrace (System.err); } return null; } public Object buildActions () { super.buildActions (); schedule = new ScheduleImpl (this, 1); stopSchedule = new ScheduleImpl (this, true); schedule.at$createFAction (0, createCall ()); stopSchedule.at$createFAction (10, createStopCall ()); return this; } public Activity activateIn (Swarm swarmContext) { super.activateIn (swarmContext); schedule.activateIn (this); stopSchedule.activateIn (this); return getActivity (); } static void main (String[] args) { Globals.env.initSwarm ("TestFActionArgs", "0.0", "bug-swarm@santafe.edu", args); TestFActionArgs swarm = new TestFActionArgs (Globals.env.globalZone); swarm.buildObjects (); swarm.buildActions (); swarm.activateIn (null).run (); } }