swarm-support
[Top][All Lists]
Advanced

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

Finding events at a particular time in a Schedule


From: Tee Toth-Fejel
Subject: Finding events at a particular time in a Schedule
Date: Thu, 21 Sep 2000 13:03:06 -0400

Finding the events contained in a schedule is relatively easy:

    swarm.collections.StringImpl strc = new StringImpl(getZone());
    System.out.println("DUMP SCHEDULE at " + Globals.env.getCurrentTime());
    schedule.describeForEach(strc);
    System.out.println(strc.getC());
    strc.drop();

But what if I don't care about the past, i.e. events scheduled before
Globals.env.getCurrentTime())?

What if I only want to find out the events at a particular point? It seems
silly to parse a multi-line string to figure that out.

The method schedule.atOffset(index) is close, but only if there is some way
to correlate time to  the index.
To make matters worse, there may be some bug in the system, because swarm
dumps when I try looking at all the events:

The code:
int last = schedule.getCount();
    try
        {
        for (int i=1; i < last; i++)
          {
          if (null == schedule.atOffset(i))
            { System.out.println(i +"null");
            }
          else
            { System.out.println(i +". "+schedule.atOffset(i));
            }
          }
        }
    catch (Exception e)
        {
        System.out.println("broke reading schedule");
        e.printStackTrace();
        }

Results in:

1. address@hidden
2. address@hidden
3. address@hidden
4. address@hidden
5. address@hidden
6. address@hidden
7. address@hidden
8. address@hidden
9. address@hidden
10. address@hidden
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/NullPointerException
      0 [sig] Kaffe 2176 stackdump: Dumping stack trace to
Kaffe.exe.stackdump

 $ less Kaffe*
59996848 [main] Kaffe 2176 sig_send: wait for sig_complete event failed, sig
6, rc 258, Win32 error
0

Finally, if there are more than one events taking place at a time step, then
how do I make sure that one of them (e.g.
getControlPanel().setStateStopped();) happens last, especially if it was the
first one scheduled?  Is there any way to find out from the schedule if a
particular event has been run at a time step?  The Tutorial says that
Schedules can be given a policy on how to handle concurrent events, but I
can't find that documentation either in the Swarm User Guide or the
Reference Guide.

Thanks for any help you can give.  Attached is the entire Java file.
 <<jFredGUISwarm.java>> 
(I'm running on Windows NT 4.0, Java 1.3, Swarm 2.1.1.)

Tihamer "Tee" Toth-Fejel                    Member of Technical Staff
(734) 623-2544   address@hidden      http://www.anteaters.net/ttf/  
Center for Electronic Commerce, Environmental Research Institute of Michigan



Attachment: jFredGUISwarm.java
Description: Binary data


reply via email to

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