swarm-support
[Top][All Lists]
Advanced

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

Re: ObjectLoader


From: M Lang / S Railsback
Subject: Re: ObjectLoader
Date: Thu, 25 Apr 2002 07:48:08 -0600

Alex Lancaster wrote:
> 
> >>>>> "SO" == Stacy Oerder <address@hidden> writes:
> 
> Use of the ObjectLoaderclass is certainly deprecated.  Which version
> of the tutorial are you using, you should really be using at least
> 2.1.1?  The 2.1.1 version of the tutorial has dropped all references
> to the ObjectLoader and model.setup.

Despite ObjectLoader being deprecated, it is still very nice as a way to
load model parameters- we depend on it for that a lot. (I hope it stays
in the code!)

For example, in our trout model's Observer Swarm, after we create the
model swarm, we use this statement to load in the model swarm
parameters:

     [ObjectLoader load: troutModelSwarm fromFileNamed: "Model.Setup"];

That should be all you need to do. Here is some documentation I wrote up
a long time ago for setup files using ObjectLoader. The only thing we
may have problems with is that using "#" at the start of a line to
comment it out seems not to always work (as I vaguely recollect).

steve

The model setup files and the parameter files are read by Swarm's
"object loader" facility. The object loader is a simple and easy tool
for reading in variable values for an object (in our case, the objects
being loaded are the Experiment, Observer, and Model swarms ...). The
setup and parameter files described below must be in the following
object loader format.

· The first line has only the text @begin;

· There is one line per parameter, with each line containing the
parameter name followed by its value. 

· Parameters need not be in any particular order.

· The parameter must be spelled exactly as it is in the code, including
upper/lower case. (The parameter names in these files should only be
changed when the code is changed to use a new or different parameter.)

· For parameters that contain text instead of numbers, the value text
does not use quotation marks.

· Parameters containing text must not have trailing blanks after the
text input. For example, a parameter that has values of either NO or YES
must not have a blank space after the value. (The blank will be read as
part of the parameter value, which can make the code unable to interpret
the value. If the parameter is a file name, the code will be unable to
open the file because it will look for a file with a blank at the end of
its name.) 

· Integer values should not have a decimal point.

· The last line has only the text @end.

· Comment lines (ignored by the computer) can be included in the file;
they start with the character #. 

· For lines containing non-text parameters, the space following the
parameter value can be used for comments. For example: 

        numberOfFish   10  This is the number of starting fish

· Lines containing text variables should not include comments, as the
comment text will be read as part of the variable value text.

-- 
address@hidden
Lang, Railsback & Assoc.
250 California Ave., Arcata CA 95521
707-822-0453; Fax 822-1868

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