net.sf.tankbattles.simulation
Class ThreadController

java.lang.Object
  extended by net.sf.tankbattles.simulation.ThreadController

public class ThreadController
extends java.lang.Object

Controls the threads of the simulators. The jME SimplePhysicsGame creates one main thread for the update and render. This is comonly known as the OpenGL thread. This class takes care of the other threads in the simulation, one for the mission goals evaluator and one for each tank. Tank threads are taken care of to avoid system overload.

Author:
erickpassos

Method Summary
 void addTankController(Tank tank, java.lang.Object lock)
          Creates a Thread and AbstractTankController object for the tank.
static ThreadController getInstance()
          The singleton instance accessor method.
 void startMissionSimulator(AbstractMissionSimulator missionSimulator)
          For creating and starting the mission simulator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ThreadController getInstance()
The singleton instance accessor method.

Returns:
the singleton instance.

addTankController

public void addTankController(Tank tank,
                              java.lang.Object lock)
Creates a Thread and AbstractTankController object for the tank. The controller is created from the class defined in the tank configuration object. The thread is added to the threadgroup.

Parameters:
tank - configuration object.
lock - for thread synchronizing.

startMissionSimulator

public void startMissionSimulator(AbstractMissionSimulator missionSimulator)
For creating and starting the mission simulator.

Parameters:
missionSimulator -