fr.emn.reactiveinput.devices
Class DSwCommand

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

public class DSwCommand
extends AbstractDevice

Author:
Pierre

Nested Class Summary
static class DSwCommand.CmdEnum
           
 
Field Summary
 In arg1
           
 In arg2
           
 In cmd
           
 Out errorMsg
           
 In perform
           
static java.lang.String[] SUPPORTED_COMMANDS
           
 Out thru_arg1
           
 Out thru_arg2
           
 Out thru_cmd
           
 Out valid
           
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DSwCommand()
           
 
Method Summary
static java.lang.String getCommandError(java.lang.String cmd, java.lang.Object arg1, java.lang.Object arg2)
          Returns an error msg or null if command is valid.
 DSwCommand.CmdEnum getDefaultCommand()
           
 boolean hasExternalInput()
          Specifies whether this device has external (implicit) input or not.
 boolean hasExternalOutput()
          Specifies whether this device has external (implicit) output or not.
 void init()
          Initializes device's output values.
 void performCommand(java.lang.String cmd, java.lang.Object arg1, java.lang.Object arg2)
           
 void setDefaultCommand(DSwCommand.CmdEnum defaultCommand)
           
 void update()
          Updates device's output values.
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, close, copy, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, open, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_COMMANDS

public static final java.lang.String[] SUPPORTED_COMMANDS

perform

public final In perform

cmd

public final In cmd

arg1

public final In arg1

arg2

public final In arg2

valid

public final Out valid

errorMsg

public final Out errorMsg

thru_cmd

public final Out thru_cmd

thru_arg1

public final Out thru_arg1

thru_arg2

public final Out thru_arg2
Constructor Detail

DSwCommand

public DSwCommand()
Method Detail

getCommandError

public static java.lang.String getCommandError(java.lang.String cmd,
                                               java.lang.Object arg1,
                                               java.lang.Object arg2)
Returns an error msg or null if command is valid.


performCommand

public void performCommand(java.lang.String cmd,
                           java.lang.Object arg1,
                           java.lang.Object arg2)

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()

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()

getDefaultCommand

public DSwCommand.CmdEnum getDefaultCommand()
Returns:
Returns the defaultCommand.

setDefaultCommand

public void setDefaultCommand(DSwCommand.CmdEnum defaultCommand)
Parameters:
defaultCommand - The defaultCommand to set.

hasExternalInput

public boolean hasExternalInput()
Description copied from class: AbstractDevice
Specifies whether this device has external (implicit) input or not. Returns false by default.

Return false if the device is deterministic from the data & time points of view, i.e. if its output production only depend on the explicit input history (input slots) and device's initial configuration. This is the case of most of the processing devices.

Return true if output values not only depend on the values of input slots, or if output production takes undefined time. Examples of devices with external input are input peripherals and asynchronous devices.

This method is used by the reactive machine to determine if this device is triggered by its input slots, or if it must be triggered continuously (i.e. each tick). This method can also be used by the editor for the device's graphical representation.

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

hasExternalOutput

public boolean hasExternalOutput()
Description copied from class: AbstractDevice
Specifies whether this device has external (implicit) output or not. Returns false by default.

Return false if the device has no border effects. Most of input and processing devices are in this case.

Return true if the device has border effects, such as graphical feedback, or control of some external value. Examples of devices with external output are application-interfacing devices and all user feedback devices.

This method can be used by the editor for the device's graphical representation. However there is at now no clear definition of what is external output.

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