swarm-support
[Top][All Lists]
Advanced

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

FAction


From: Fred Wan
Subject: FAction
Date: Tue, 5 Sep 2000 20:56:06 +0200

Hi, in some of the java examples I found two different ways of sending a
message to each member in a collection (mostly lists). In the first fragment
below (from SimpleSwarmBug), the method createActionForEach is used to send
a message to each bug in the list. In the second fragment (jheatbugs), a
much more elaborate procedure is used involving the FAction interface. It is
unclear to me what the difference is, and even after studying the reference
guide I have not found out why the second procedure is necessary in this
case. Can someone please elucidate the difference and the necessity of using
FAction?

Thanks,

Fred Wan,
dept. Artificial Intelligence,
Vrije Universiteit Amsterdam,
The Netherlands.

        try {

        sel = new Selector(Class.forName("SimpleBug"), "randomWalk", false);
        modelActions.createActionForEach$message(bugList, sel);

        } catch (Exception e)
        {
        System.err.println("Exception randomWalk: " +
        e.getMessage ());
        System.exit(1);
        }

****************************************************************************
**


 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);
    }


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