fr.emn.reactiveinput
Interface Processor

All Known Implementing Classes:
AbstractDevice

public interface Processor

A device processor.

A device processor computes device's output slots values from its input slots values, or from extern values as in input devices. A device can have a unique processor (e.g. itself, if it implements Processor interface), or several possible processors, each corresponding to a specific configuration of the device. Separating execution methods from the Device class allows code specialization, or even use of native code for the execution.

Prior to execution, each device has a unique processor, or no processor at all if it is not properly configured. Only devices that have a processor are added to the execution list.

See Also:
Device.getProcessor()

Method Summary
 void init()
          Initializes device's output values.
 void update()
          Updates device's output values.
 

Method Detail

init

public void init()
Initializes device's output values.

After the reactive machine has been started and when the device is ready to process, this method is called to initialize output values.

init() is not called before all obligatory input slots have been initalized, i.e. have received a value. In fact, this method is called in place of update() when the device has just received enough input data to start processing. This may happen at the first tick, or maybe after.

If the device has only optional input slots or no input slot at all, init() is called at the first tick, even if no input signal is received.

Important Note: This method is not a device initialization method, and it must execute as fast as update(). It just gives you the opportunity to handle first output values differently, just as with Lustre ->'s operator. All other initializations must be performed in open() method.

Also remember that a reactive machine can be stopped and restarted, so init() can be called several times.

See Also:
update()

update

public void update()
Updates device's output values.

This method is called by the reactive machine each time the device receives an input signal. It can also be called continuously (at each tick) if the device has declared external input.

update() can not be called if init() has not been previously called.

update() and init() are never called in the same tick.

See Also:
init()