コード例 #1
0
ファイル: ControllIO.java プロジェクト: Diex/residua
 /**
  * Use this method to get a Device. You can get a device by its name or its number. Use
  * printDevices to see what devices are available on your system.
  *
  * @param i_deviceNumber int, number of the device to open
  * @return ControllDevice, the device coresponding to the given number or name
  * @example procontroll
  * @related ControllIO
  * @related ControllDevice
  * @related getNumberOfDevices ( )
  * @related printDevices ( )
  * @shortdesc Use this method to get a device.
  * @usage application
  */
 public ControllDevice getDevice(final int i_deviceNumber) {
   if (i_deviceNumber >= getNumberOfDevices()) {
     throw new RuntimeException("There is no device with the number " + i_deviceNumber + ".");
   }
   ControllDevice result = (ControllDevice) devices.get(i_deviceNumber);
   result.open();
   return result;
 }
コード例 #2
0
ファイル: ControllIO.java プロジェクト: Diex/residua
 /**
  * @param i_intputDevice String: the name of the device that triggers the plug
  * @param i_input int: the name of the button that triggers the plug
  */
 public void plug(
     final Object i_object,
     final String i_methodName,
     final int i_eventType,
     final String i_intputDevice,
     final String i_input) {
   ControllDevice device = getDevice(i_intputDevice);
   device.plug(i_object, i_methodName, i_eventType, i_input);
 }
コード例 #3
0
ファイル: ControllIO.java プロジェクト: Diex/residua
 /** @param i_deviceName String, name of the device to open */
 public ControllDevice getDevice(final String i_deviceName) {
   for (int i = 0; i < getNumberOfDevices(); i++) {
     ControllDevice device = (ControllDevice) devices.get(i);
     if (device.getName().equals(i_deviceName)) {
       device.open();
       return device;
     }
   }
   throw new RuntimeException("There is no device with the name " + i_deviceName + ".");
 }