Collective Behavior

 

Fishswarm.png

 Shark shark = new Shark();
 Collection<Fish> swarm = new ArrayList();
 for ( ... ) swarm.add(new Fish());
 ...
 swarm.mimicryAttack(shark);

 

Swarm Behavior is a new composition operator that associates behavior with a collection of instances. The lookup of swarm behavior is based on the element type of a collection and is thus orthogonal to the collection hierarchy.

The method mimicryAttack

  • is defined in the lexical scope of the Fish class,
  • is available for all subtypes of Collection, but
  • limited to collections that contain Fish instances.
  • can be overridden by subclasses of the Fish class.

 

NB, useful for both static and dynamic languages.


Publications

  • Adrian Kuhn, David Erni, Marcus Denker, "Empowering Collections with Swarm Behavior," to be submitted to somewhere sometimes, (mail us to get a copy).

Downloads

People

Last changed by admin on 21 April 2009