swarm-support
[Top][All Lists]
Advanced

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

RE: FCallImpl


From: Fred Wan
Subject: RE: FCallImpl
Date: Sun, 31 Dec 2000 16:21:57 +0100

So, are you suggesting not to use FActionCreatingForEachHomogeneous
interface at all?


> In my opinion, if you just want to process through a list of objects,
> createActionForEach is getting cumbersome enough that I just write the
> loop in a java method, and then schedule that method to run.


I am trying to understand how this works, but it is obviously very
complicated. There is also an assignment to 'actionForEach' in the heatbug
example of which understand the purpose because it is never used anywhere
else.

    try {
      Heatbug proto = (Heatbug) heatbugList.get (0);
      Selector sel =
        new Selector (proto.getClass (), "heatbugStep", false);
      actionForEach =
        modelActions.createFActionForEachHomogeneous$call
        (heatbugList,
         new FCallImpl (this, proto, sel,
                        new FArgumentsImpl (this, sel, true)));
    } catch (Exception e) {
      e.printStackTrace (System.err);
    }

I tried to apply it to the SimpleObserverBug tutorial example but I just get
a crash and no further message. This is probably _the_ drawback of dynamic
binding. The only difference is, is that heatbugList is a java List, while
bugList is a swarm List, but according to the manual (interface
FActionCreatingForEachHomogeneous) this should not be a problem.

        SimpleBug proto = (SimpleBug) bugList.getFirst();
        sel = new Selector(proto.getClass(), "randomWalk", false);
        actionForEach=
            modelActions.createFActionForEachHomogeneous$call
                (bugList,
                 new FCallImpl(this, proto, sel,
                   new FArgumentsImpl(this,sel,true)));
        } catch (Exception e)
        {
        System.err.println("Exception randomWalk: " +
        e.getMessage ());

Thanks.


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