swarm-support
[Top][All Lists]
Advanced

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

RE: Two actions at one time in schedule breaks next


From: Tee Toth-Fejel
Subject: RE: Two actions at one time in schedule breaks next
Date: Mon, 27 Nov 2000 16:13:09 -0500

> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Sent: Wednesday, November 22, 2000 12:02 PM
> To: address@hidden
> Subject: Re: Two actions at one time in schedule breaks next
> 
> TestMapIndexOld schedules two concurrent events, and then looks at the
> schedule.  The action that is in that spot is an instance of a native
> Swarm-internal class, ActionConcurrent_c.  Since users don't
> explicitly make these instances, and there is no declared interface
> for it in Java, i.e. swarm.jar, one must be constructed on-the-fly.
> That's what the gnu.bytecode library does (in kawa.jar): it generates
> bytecode for a new class with that name. 

Very cool, but then how do I get the time of the swarm.activity.ActionToImpl
and ActionConcurrent_c instances?  I can do a getClass on the object
returned by index.next, but then since it's not really a java class, I can't
cast it and then do a getKey() on it. 

eg:
        Object thing = index.next();
      System.out.println ("event: " + thing);
      Class classOfThing = thing.getClass();
      System.out.println ("classOfThing="+classOfThing.toString());
      if  (classOfThing.toString().equals("class
swarm.activity.ActionToImpl"))
        {
        swarm.activity.ActionToImpl oneAction =
(swarm.activity.ActionToImpl) thing;
        System.out.println ("One action per time unit: "+oneAction.getKey+"
"+oneAction.toString());
        }
      else if (classOfThing.toString().equals("class ActionConcurrent_c"))
        {
        ActionConcurrent_c manyActions = (ActionConcurrent_c) thing;
        System.out.println ("Many actions in this time unit:
"+manyActions.getKey+" "+manyActions.toString());
        }
      else
        {
        System.out.println ("Thing's class "+classOfThing.toString()+" not
identified");
        }

How else do I get the key for each of the actions or concurrent actions?

What I need to do is, given a time, find the first action in the schedule
*after* that time.  Also, I need to be able to determine the last action in
a concurrent group, and if it is not a "pause", add another "pause" to the
end of group at a particular time unit.

Thanks!

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


                  ==================================
   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]