cdx
Class DetectorHandler

java.lang.Object
  extended by javax.safetycritical.AbstractAsyncEventHandler
      extended by javax.safetycritical.AsyncEventHandler
          extended by javax.safetycritical.BoundAsyncEventHandler
              extended by javax.safetycritical.ManagedEventHandler
                  extended by javax.safetycritical.AperiodicEventHandler
                      extended by cdx.DetectorHandler
All Implemented Interfaces:
java.lang.Runnable, javax.safetycritical.ManagedSchedulable, javax.safetycritical.Schedulable

public class DetectorHandler
extends javax.safetycritical.AperiodicEventHandler

DetectorHandler instances carry out the actual collisions detection. Each DetectorHandler takes in a list of lists of motions, each set contains the motions that span cross a same voxel. The collisions detection carried out here considers the Z axis, and also updates the collisions number recorded in the CDxMission. If this DetectorHanndler has finished, it updates its state in DetectorControl.


Field Summary
 DetectorControl control
          To get the control of DetectorControl.
 int id
          The Identity of this DetectorHandler.
 CDxMission mission
          To get the control of the current mission.
 
Constructor Summary
DetectorHandler(CDxMission mission, DetectorControl control, int id, javax.safetycritical.AperiodicEvent event_bound)
          Constructor
 
Method Summary
 int CalcPartCollisions()
          Method to get the allocated list of lists of motions by its ID, and detect collisions
 int determineCollisions(List motions)
          Compute the number of collisions for a List of Motion objects.
 void handleEvent()
          Major actions happen within handlerEvent() including calculation, updation of the number of collisions, and notification to DetectorControl.
 
Methods inherited from class javax.safetycritical.AperiodicEventHandler
register
 
Methods inherited from class javax.safetycritical.ManagedEventHandler
cleanup, getName
 
Methods inherited from class javax.safetycritical.AsyncEventHandler
handleAsyncEvent
 
Methods inherited from class javax.safetycritical.AbstractAsyncEventHandler
run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

mission

public final CDxMission mission
To get the control of the current mission.


control

public final DetectorControl control
To get the control of DetectorControl.


id

public final int id
The Identity of this DetectorHandler.

Constructor Detail

DetectorHandler

public DetectorHandler(CDxMission mission,
                       DetectorControl control,
                       int id,
                       javax.safetycritical.AperiodicEvent event_bound)
Constructor

Parameters:
mission - the current mission
control - the control of DectectoControl
id - the assigned ID
event_bound - the event to release this DetectorHandler
Method Detail

handleEvent

public void handleEvent()
Major actions happen within handlerEvent() including calculation, updation of the number of collisions, and notification to DetectorControl.


CalcPartCollisions

public int CalcPartCollisions()
Method to get the allocated list of lists of motions by its ID, and detect collisions

Returns:
the number of collisions

determineCollisions

public int determineCollisions(List motions)
Compute the number of collisions for a List of Motion objects.

Parameters:
motions - the list of motions to be checked
Returns:
the number of collisions within this list