There are really only two main changes which are likely to affect existing users, and all other changes required in user's applications mostly flow from these two changes:
All Swarm functionality is now exported through a single, well-defined interface: Objective C protocols. Essentially this means that all creatable or subclass-able protocols now follow the same conventions as those in the defobj, activity and collections libraries. This means that static typing of Swarm protocols is now obsolete across the whole package.
Library header files no longer include any of their individual class header files.
The XPixmap
protocol has now
been changed to Pixmap
to divorce
itself from it's association with
X-Windows.
Any subclass of a class defined as a Swarm
protocol now requires the *specific* importation of that
protocol's header file. Previously, only a warning was
raised. This particularly affects
Swarm
and
SwarmObject
. If you define something
like:
@interface MyObject: SwarmObject
then you need to include:
#import objectbase/SwarmObject.h
Similarly, if you subclass from Swarm, you will require
objectbase/Swarm.h
All references to objects conforming to Swarm protocols should either be defined to conform to the appropriate Swarm protocol, or be left untyped. In no circumstance should it be statically typed. In practice, this means that you can write, either:
id Grid2d world; OR id world;
but NOT
Grid2d *world;
Note that this only applies to protocols defined by Swarm proper, not to your own classes, although it is good practice to adopt a convention and stick to it.
HeatSpace.h
Include header file for
space/Diffuse2d
(x)
Heatbug.h
Make instance variable world conform to protocol:
id Grid2d world
NOT
id Grid2d *;
(x)
Heatbug.m
In [Heatbug -setWorld:]
method:
make cast to protocol not static (x)
HeatbugModelSwarm.h
HeatbugObserverSwarm.h
Make instance variable id Grid2d
world
NOT Grid2d *world
(x)
Change static cast of [HeatbugObserverSwarm
-getWorld:]
method to protocol version (x)
Change all the below to conform to their respective protocols (x)
EZGraph *unhappyGraph; Value2dDisplay *heatDisplay; Object2dDisplay *heatbugDisplay;
MousetrapModelSwarm.h
Import objectbase/Swarm.h
for subclassing from Swarm (*)
Remove imports of activity.h
collections.h simtools.h
objectbase.h
irrelevant, as not used in
the interface. (x)
Make instance of Grid2d
conform to
protocol, not static typed. (x)
MousetrapObserverSwarm.h
Make instances of EZGraph,
Object2dDisplay
conform to protocol, rather than
be statically typed. (x)
Mousetrap.h
Remove import of
objectbase.h
(x)