anthill.antnet
Class ConcurrentManager

java.lang.Object
  |
  +--anthill.antnet.ConcurrentManager
All Implemented Interfaces:
Clearable, Manager

public class ConcurrentManager
extends java.lang.Object
implements Manager

Implementations of Manager capable to manage multiple threads.

Version:
$Revision$
Author:
Alberto Montresor

Constructor Summary
ConcurrentManager(int nthreads)
          Instantiates a thread manager by creating a number of threads which will take care of the ants.
 
Method Summary
 void add(AntView view)
          Adds an ant to the queue of ants to be executed.
 void clear()
          Restores the object to its initial state.
 void execute()
          Execute an ant stored in this Manager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentManager

public ConcurrentManager(int nthreads)
Instantiates a thread manager by creating a number of threads which will take care of the ants.
Method Detail

add

public void add(AntView view)
Adds an ant to the queue of ants to be executed. The ant is enclosed in the AntView object which representes the environment in which the ant will survive.
Specified by:
add in interface Manager
Parameters:
viewdesc - the ant view containing the ant to be added

execute

public void execute()
Execute an ant stored in this Manager
Specified by:
execute in interface Manager

clear

public void clear()
Restores the object to its initial state.
Specified by:
clear in interface Clearable