net.lenkaspace.creeper
Class CRController

java.lang.Object
  extended by net.lenkaspace.creeper.CRController
All Implemented Interfaces:
java.lang.Runnable

public class CRController
extends java.lang.Object
implements java.lang.Runnable

The main controller holding all the parts together. Maintains the main update loop and other threads

Version:
2.0
Author:
Lenka Pitonakova contact@lenkaspace.net

Constructor Summary
CRController(java.lang.String applicationName_)
          Constructor
 
Method Summary
 void createDefaultControlPanel()
          Create an instance of CRControlPanel and add it to the applet
 CRControlPanel getControlPanel()
           
 CRImageProvider getImageProvider()
           
 CRRenderer getRenderer()
           
 CRReportController getReportController()
           
 int getRunNumber()
           
 int getTimeCounter()
           
 int getTimeCounterSinceTrialStart()
           
 int getTimeUnits()
           
 int getTrialNumber()
           
 CRWorld getWorld()
           
 void initRun()
          Initialise a run (a collection of trials).
 void initTrial()
          Initialise a trial.
 void run()
          Main thread
 void setControlPanel(CRControlPanel controlPanel_)
          Remove old control panel, store reference to the new one and place it instead of the old one
 void setImageProvider(CRImageProvider imageProvider_)
           
 void setReportController(CRReportController reportController_)
           
 void setTimeSpeed(double value_)
          Sets update timer delay to a value from interval specified by CRSettings's maxUpdateDelay and minUpdateDelay
 void setWorld(CRWorld world_)
           
 void startSimulation(double timeSpeed_, boolean calledManually_)
          Start all threads.
 void startTime()
          Starts timers
 void stopTime()
          Stop painter timer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRController

public CRController(java.lang.String applicationName_)
Constructor

Parameters:
applicationName_ - Name of the application that will appear on the application window
Method Detail

createDefaultControlPanel

public void createDefaultControlPanel()
Create an instance of CRControlPanel and add it to the applet


startSimulation

public void startSimulation(double timeSpeed_,
                            boolean calledManually_)
Start all threads. Call after everything has been initialised.

Parameters:
timeSpeed_ - double time speed from range [0;1]
calledManually_ - double set to true if you are calling this function programatically, not from the ControlPanel

initRun

public void initRun()
Initialise a run (a collection of trials).


initTrial

public void initTrial()
Initialise a trial. Create a new world with some new settings.


run

public void run()
Main thread

Specified by:
run in interface java.lang.Runnable

startTime

public void startTime()
Starts timers


stopTime

public void stopTime()
Stop painter timer


setTimeSpeed

public void setTimeSpeed(double value_)
Sets update timer delay to a value from interval specified by CRSettings's maxUpdateDelay and minUpdateDelay

Parameters:
value_ - <0;1> where 0 = slowest

getControlPanel

public CRControlPanel getControlPanel()

setControlPanel

public void setControlPanel(CRControlPanel controlPanel_)
Remove old control panel, store reference to the new one and place it instead of the old one

Parameters:
controlPanel_ - CRControlPanel new control panel

getWorld

public CRWorld getWorld()

setWorld

public void setWorld(CRWorld world_)

getReportController

public CRReportController getReportController()

setReportController

public void setReportController(CRReportController reportController_)

getImageProvider

public CRImageProvider getImageProvider()

setImageProvider

public void setImageProvider(CRImageProvider imageProvider_)

getTimeUnits

public int getTimeUnits()

getTimeCounter

public int getTimeCounter()

getTimeCounterSinceTrialStart

public int getTimeCounterSinceTrialStart()

getTrialNumber

public int getTrialNumber()

getRunNumber

public int getRunNumber()

getRenderer

public CRRenderer getRenderer()