[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ActionGroup problem in JBuilder 4
From: |
Marcus G. Daniels |
Subject: |
Re: ActionGroup problem in JBuilder 4 |
Date: |
04 Apr 2001 08:13:18 -0700 |
User-agent: |
Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.4 |
>>>>> "ZS" == Zoltan Szaniszlo <address@hidden> writes:
Selector sel = new Selector(g.getClass(),"Checking",false);
actionForMachines =
modelActions.createFActionForEachHomogeneous$call(machineList,
new FCallImpl (getZone(),g,sel,new FArgumentsImpl (getZone (),sel,true)));
I know, you're asking "what the heck is that?!"
Here's the deconstruction:
1) Get a selector for "Checking".
Swarm thinks in terms of messages in and of themselves. A Selector
is an object that represents a message that can be sent to any object.
In Java, in order to check for the existence of be a message, it is
necessary to name a class. (In Objective C you don't.)
2) FArguments
Before Swarm 2.0 the only kind of data you could pass to a method
was an object or something pointer like. Often people want to pass
numbers, esp. doubles, so FArguments is there to build up an argument
list with arbitrary types. There are messages for FArguments like
`addDouble', `addSelector', etc.
3) With the addition of Java support (and COM), it is necessary to
be able to make calls in a language-specific way. FCall is the
class that knows how to do this. Sometimes, in models, it is
desirable to use this in order to get more performance. You say
explicitly that an Action will be for Java -- that way Swarm doesn't
have to waste time checking during the execution of the model.
4) createFActionForEachHomogeneous: This is a way to create a
ForEach Action that assumes the set is made up of of a fixed set
of agents that are all of the same kind. This allows for
optimization of the iteration (the set is put in an primitive
array instead of a linked list), dispatch (the `implementation'
of the message is looked-up once, when the call is constructed),
and calling (the language callout procedure is fixed at the start).
jheatbugs probably shouldn't have this (obscure) code in it, but we
threw it in for the sake of completeness..
==================================
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.