fr.emn.reactiveinput
Class MissingDevice

java.lang.Object
  extended byfr.emn.reactiveinput.AbstractDevice
      extended byfr.emn.reactiveinput.MissingDevice
All Implemented Interfaces:
Device, Processor

public class MissingDevice
extends AbstractDevice

A device that was not found. Not executable.


Field Summary
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
MissingDevice(java.lang.String name)
           
 
Method Summary
 In addAbsentIn(java.lang.String name)
          Adds an inSlot.
 Out addAbsentOut(java.lang.String name)
          Adds an outSlot to the device.
 java.lang.String getError()
          Subclass this method to return the current error message (FAILED state).
 void init()
          Initializes device's output values.
 boolean isOpenable()
          Returns true if the device can be opened.
 Processor open(OpenContext context)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
 void update()
          Updates device's output values.
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, close, copy, doDisable, doEnable, finalize, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalInput, hasExternalOutput, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MissingDevice

public MissingDevice(java.lang.String name)
Method Detail

addAbsentIn

public final In addAbsentIn(java.lang.String name)
Adds an inSlot.


addAbsentOut

public final Out addAbsentOut(java.lang.String name)
Adds an outSlot to the device.


getError

public java.lang.String getError()
Description copied from class: AbstractDevice
Subclass this method to return the current error message (FAILED state). By default, returns the last error set by setLastError() method.

Specified by:
getError in interface Device
Overrides:
getError in class AbstractDevice

init

public void init()
Description copied from class: AbstractDevice
Initializes device's output values.

Subclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors. By default, this method calls update(). Subclass this method if you'd like to make a specific initialization routine.

Specified by:
init in interface Processor
Overrides:
init in class AbstractDevice
See Also:
Processor.init()

isOpenable

public boolean isOpenable()
Description copied from class: AbstractDevice
Returns true if the device can be opened.

By default, returns true if all obligatory input slots are valid. Subclass this method to add more conditions.

Specified by:
isOpenable in interface Device
Overrides:
isOpenable in class AbstractDevice

open

public Processor open(OpenContext context)
Description copied from class: AbstractDevice
Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.

By default, open() does nothing and returns the device itself as the Processor (or null if it is not openable): AbstractDevice implements both Device and Processor interfaces, so that you can add processing code directly into the device.

If you want to add specialization features, subclass this method to return a specific processor implementation depending on your device configuration.

Example :

public Processor getProcessor() { if (super.open() == null) return null; // Select the right processor if (in2.isValid()) { return new twoParamProcessor(in1, in2, out); else return new oneParamProcessor(in1, out); }

In this method, you may also perform all necessary pre-running initialization. If initialization fails, return null even if isOpenable() returns true.

In all cases, return null if isOpenable() returns false.

Specified by:
open in interface Device
Overrides:
open in class AbstractDevice
See Also:
Processor, Device.open()

update

public void update()
Description copied from class: AbstractDevice
Updates device's output values.

Subclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors.

Specified by:
update in interface Processor
Overrides:
update in class AbstractDevice
See Also:
Processor.update()