fr.emn.reactiveinput.devices
Class DXInput

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

public class DXInput
extends AbstractDevice


Field Summary
protected  Out[] axes_out_
           
protected  XDeviceInfo device_info_
           
protected  long display_
           
protected  FExtXInput fExtXInput_
           
protected  int id_
           
protected  int[] last_axes_out_
           
protected  boolean last_proximity_
           
protected  long motion_class_
           
protected  int motion_type_
           
protected  java.lang.String name_
           
protected  int[] next_axes_out_
           
protected  boolean next_proximity_
           
protected  int number_axes_out_
           
protected  long proximity_class_
           
protected  int proximity_in_type_
           
protected  Out proximity_out_
           
protected  int proximity_out_type_
           
protected  int window_
           
protected  Out x
           
protected  XEvent xevent_
           
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DXInput(long display, int window, XDeviceInfo deviceInfo, FExtXInput fExtXInput)
           
 
Method Summary
 void actualUpdate()
           
 void close()
          Add closing code here if needed.
 Device copy()
          Is isCopiable() returns true, copies the device by calling DeviceUtilities.defaultCopy().
 long getMotionClass()
           
 long getProximityClass()
           
 boolean hasExternalInput()
          Specifies whether this device has external (implicit) input or not.
 Processor open(OpenContext receiver)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
 boolean tryUpdate(XEvent event)
           
 void update()
          Updates device's output values.
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalOutput, init, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

display_

protected long display_

window_

protected int window_

id_

protected int id_

name_

protected java.lang.String name_

motion_class_

protected long motion_class_

motion_type_

protected int motion_type_

proximity_class_

protected long proximity_class_

proximity_in_type_

protected int proximity_in_type_

proximity_out_type_

protected int proximity_out_type_

device_info_

protected XDeviceInfo device_info_

x

protected Out x

number_axes_out_

protected int number_axes_out_

axes_out_

protected Out[] axes_out_

last_axes_out_

protected int[] last_axes_out_

next_axes_out_

protected int[] next_axes_out_

last_proximity_

protected boolean last_proximity_

next_proximity_

protected boolean next_proximity_

proximity_out_

protected Out proximity_out_

xevent_

protected XEvent xevent_

fExtXInput_

protected FExtXInput fExtXInput_
Constructor Detail

DXInput

public DXInput(long display,
               int window,
               XDeviceInfo deviceInfo,
               FExtXInput fExtXInput)
Method Detail

getProximityClass

public long getProximityClass()

getMotionClass

public long getMotionClass()

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

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

tryUpdate

public boolean tryUpdate(XEvent event)

actualUpdate

public void actualUpdate()

copy

public Device copy()
Description copied from class: AbstractDevice
Is isCopiable() returns true, copies the device by calling DeviceUtilities.defaultCopy(). Returns null if isCopiable() returns false.

Subclass this method if you want to provide another strategy.

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

open

public Processor open(OpenContext receiver)
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()

close

public void close()
Description copied from class: AbstractDevice
Add closing code here if needed.

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