|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectfr.emn.reactiveinput.AbstractDevice
fr.emn.reactiveinput.AbstractMutableDevice
fr.emn.reactiveinput.devices.DWatcher
A watcher example. (Add RemoveSlot functionalities)
| Field Summary | |
In[] |
ins
|
int |
MAX_SLOTS
|
int |
MIN_SLOTS
|
| Fields inherited from class fr.emn.reactiveinput.AbstractDevice |
currIndex, outs |
| Fields inherited from interface fr.emn.reactiveinput.Device |
AUTO_PROPERTIES |
| Constructor Summary | |
DWatcher()
|
|
| Method Summary | |
protected void |
addSlots(int num,
boolean dynamic)
|
void |
close()
Closes the device. |
DeviceInfo |
getDeviceInfo()
|
Slot[] |
getMutationTriggers()
Returns the mutation triggers for this mutable device, i.e. all input or output slots that trigger a mutation when it is connected to another type. |
int |
getNumSlots()
|
boolean |
hasExternalOutput()
Specifies whether this device has external (implicit) output or not. |
boolean |
isOpenable()
This device has only optional slots (which allows "holes"), but is not considered openable if nothing is connected. |
void |
mutate()
Performs a mutation on this device. |
Processor |
open(OpenContext context)
Ensures that the device will be ready for processing or producing data, and returns the Processor object that will process data, or null if an error occured. |
protected void |
removeSlots(int num)
|
void |
setNumSlots(int num)
During deserialization, this is allows device to have the proper number of slots before being connected. |
void |
update()
Updates device's output values. |
| Methods inherited from class fr.emn.reactiveinput.AbstractMutableDevice |
addMutableIn, addMutableIn, addMutableIn, addMutableOut, addMutableOut, remove |
| Methods inherited from class fr.emn.reactiveinput.AbstractDevice |
addIn, addIn, addOut, copy, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalInput, init, 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 |
| Methods inherited from interface fr.emn.reactiveinput.Device |
copy, getError, getInfo, getIns, getName, getOuts, getProperties, hasExternalInput, isCopiable, setEnabled |
| Field Detail |
public final int MIN_SLOTS
public final int MAX_SLOTS
public final In[] ins
| Constructor Detail |
public DWatcher()
| Method Detail |
protected void addSlots(int num,
boolean dynamic)
public void close()
DeviceDeallocate resources here.
close in interface Deviceclose in class AbstractDevicepublic DeviceInfo getDeviceInfo()
public Slot[] getMutationTriggers()
AbstractMutableDevice
getMutationTriggers in interface MutableDevicegetMutationTriggers in class AbstractMutableDevicepublic int getNumSlots()
public boolean hasExternalOutput()
DeviceReturn 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 this makes no difference for the reactive machine.
hasExternalOutput in interface DevicehasExternalOutput in class AbstractDevicepublic boolean isOpenable()
isOpenable in interface DeviceisOpenable in class AbstractDevicepublic void mutate()
DWatcher creates a new slot if the last slot has been connected, or removes it if it has been disconnected.
mutate in interface MutableDevicemutate in class AbstractMutableDevicepublic Processor open(OpenContext context)
DeviceSome devices may need to perform some more or less heavy initialization (such as allocating resources or opening a stream) before being able to process or produce data. This is the case for most input devices, and some I/O and output devices. All these initializations must be done in the open() method.
Because these initializations are subject to fail, open() may return null even if isOpenable() returns true. In all cases, returning a non-null Processor means that the device is now able to process or produce data.
RE-OPENING A DEVICE:
Devices always stay open during reconfiguration, in order to avoid unnecessary deallocation and reallocation of resources. However, some devices will need to be re-open before re-starting the configuration. So open() is always called on all devices before re-starting.
If open() is called on a device that is already open, it may have no effect (and the current Processor is returned), or the device may be re-open if something has changed in its configuration.
Using a Processor as a return value allows the use of different processors, each adapted to a specific device configuration.
open in interface Deviceopen in class AbstractDeviceProcessor,
Device.open()protected void removeSlots(int num)
public void setNumSlots(int num)
public void update()
AbstractDeviceSubclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors.
update in interface Processorupdate in class AbstractDeviceProcessor.update()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||