4.2. The (Swarm) OOP way

Swarm models follow a common syntax that helps users to understand the way their parts interact. The observer swarm and the model swarm are typically designed in a similar way. Methods that will appear in many classes, for example, include:

Objective C exampleJava example
+ createBegin;
- createEnd;
- buildObjects;
- buildActions;
- activateIn;
createBegin ();
createEnd ()
buildObjects ();
buildActions ();
activateIn ();

There are also methods that allow the input and output of information from the object. By custom, these are usually prefaced by the words get and set. For example:

Objective C exampleJava example
-setParameterValue: (int) value;
-(int) getParameterValue;
Object setParameterValue (int value);
int getParameterValue ();

These methods can be written to so that setParameterValue causes an object to set some internal parameter equal to a value, and getParameterValue will cause the agent to report back the value.

In addition,there will be methods that carry out the specialized actions dictated by the substance of the research problem.

The model swarm object is usually subclassed from Swarm and it is the primary object that is responsible for telling subclasses to build their agents. The model swarm also give those agents a place in memory, and schedules their activities.