net.sourceforge.frcsimulator.internals
Class CRIO

java.lang.Object
  extended by net.sourceforge.frcsimulator.internals.CRIO
All Implemented Interfaces:
FrcBotSimComponent

public class CRIO
extends java.lang.Object
implements FrcBotSimComponent

A class used by the simulator that represents a hardware CRIO.

Author:
benjamin

Field Summary
 Semaphore newDataSemaphore
           
 
Method Summary
 void addModule(CRIOModule module, int id)
          Adds a simulated module at the given location to the CRIO.
static CRIO getInstance()
          Gets the current instance of the CRIO being run by the simulator.
 CRIOModule getModule(int id)
          Gets a module from the given location on the CRIO.
 FrcBotSimProperties getSimProperties()
          Gets the properties of this component that can later be parsed by the simulator or an external program.
 boolean isDebugging()
          Returns whether or not the CRIO is in debug mode.
 void removeModule(int id)
          Removes a module from the given location on the CRIO.
 void setDebugging(boolean debug)
          Sets whether or not the CRIO is in debug mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newDataSemaphore

public Semaphore newDataSemaphore
Method Detail

addModule

public void addModule(CRIOModule module,
                      int id)
               throws ModuleException
Adds a simulated module at the given location to the CRIO.

Parameters:
module - The module to be added.
id - Where to insert the module.
Throws:
InvalidModuleException - if the module equals null.
ModuleSlotOutOfBoundsException - if the id would not fit on a hardware CRIO.
ModuleException

removeModule

public void removeModule(int id)
                  throws ModuleException
Removes a module from the given location on the CRIO.

Parameters:
id - Where to remove the module from.
Throws:
ModuleSlotOutOfBoundsException - if the id would not be on a hardware CRIO.
ModuleException

getModule

public CRIOModule getModule(int id)
                     throws ModuleException
Gets a module from the given location on the CRIO.

Parameters:
id - Where the module is located.
Returns:
An object representing the module on the CRIO.
Throws:
ModuleSlotOutOfBoundsException - if the id would not be on a hardware CRIO.
ModuleNotFoundException - if the module does not exist at that location.
ModuleException

getInstance

public static CRIO getInstance()
Gets the current instance of the CRIO being run by the simulator.

Returns:
The current CRIO instance.

isDebugging

public boolean isDebugging()
Returns whether or not the CRIO is in debug mode.

Returns:
The current debugging mode.

setDebugging

public void setDebugging(boolean debug)
Sets whether or not the CRIO is in debug mode.

Parameters:
debug - The debugging mode to be set to.

getSimProperties

public FrcBotSimProperties getSimProperties()
Gets the properties of this component that can later be parsed by the simulator or an external program.

Specified by:
getSimProperties in interface FrcBotSimComponent
Returns:
The FrcBotSimProperties of this object.