simulator
Class ProcessesHandler

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--simulator.ProcessesHandler

class ProcessesHandler
extends java.lang.Thread

This class run a thread that activate the vrml printer and the agents processes every simulation time. It use a resolution time set by user to count for departed time and a system to set if we use a real time, accelerated time or slow down time for simulation.


Field Summary
(package private)  int agentsTime
          Every agentsTime milliseconds time the agents are resumed (this time must be multiple of resolutionTime)
(package private)  java.lang.Thread printer
          Contains the vrml printer proccess
(package private)  int printerTime
          Every printerTime milliseconds time the printer is resumed (this time must be multiple of resolutionTime)
protected  java.util.Hashtable processesList
          Contains the list of agents processes
(package private)  int realTime
          This variable set the real time in the simulation with a 1 value.
(package private)  int resolutionTime
          This is the resolution time in milliseconds of the process
protected  ServerAmbient serverAmbient
          Contains the server ambient process
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadQ, values
 
Constructor Summary
ProcessesHandler(java.util.Hashtable processesList, java.lang.Thread printer, ServerAmbient serverAmbient, int resolutionTime, int printerTime, int agentsTime, int realTime)
          Initialize the processes handler and start thread
 
Method Summary
 void run()
          resume the printer processes and the agents processes at every simulation time.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

processesList

protected java.util.Hashtable processesList
Contains the list of agents processes

printer

java.lang.Thread printer
Contains the vrml printer proccess

serverAmbient

protected ServerAmbient serverAmbient
Contains the server ambient process

realTime

int realTime
This variable set the real time in the simulation with a 1 value. If the value insert is better than the simulation is slow down, else the simulation is fast. For example if resolutionTime is 100msec. and this is set to 3, this implies that we update the simulation event us 100msec was departed, but this is made in 300msec, so slow system can execute correctly the simulation even if no real time is performed.

resolutionTime

int resolutionTime
This is the resolution time in milliseconds of the process

printerTime

int printerTime
Every printerTime milliseconds time the printer is resumed (this time must be multiple of resolutionTime)

agentsTime

int agentsTime
Every agentsTime milliseconds time the agents are resumed (this time must be multiple of resolutionTime)
Constructor Detail

ProcessesHandler

public ProcessesHandler(java.util.Hashtable processesList,
                        java.lang.Thread printer,
                        ServerAmbient serverAmbient,
                        int resolutionTime,
                        int printerTime,
                        int agentsTime,
                        int realTime)
Initialize the processes handler and start thread
Parameters:
processesList - contains the list of agents processes
printer - contains the vrml printer process
serverAmbient - contains the server ambient
resolutionTime - as defined in class variable
printerTime - as defined in class variable
agentsTime - as defined in class variable
realTime - as defined in class variable
Method Detail

run

public void run()
resume the printer processes and the agents processes at every simulation time. The resume to serverAmbient seems to be necessary becouse when it will activate with an notify (and the process is suspend in a queue) not always the process become active and so the agents processes will be wait forever.
Overrides:
run in class java.lang.Thread