de.jaetzold.art
Interface Actuator

All Superinterfaces:
EventListener, PropertyChangeListener, Sensor
All Known Implementing Classes:
RawActuator

public interface Actuator
extends Sensor

Classes that represent a output-device should implement this interface. Implementations of this interface represent specific interpretations of the value this Actuator accepts and delivers.


Method Summary
 void addVetoableChangeListener(VetoableChangeListener listener)
          For Listeners which can refuse some values to be set.
 boolean getLocalReturn()
          Returns the whether value-returning methods assume no one else is using this Actuator.
 boolean getWaitForCompletion()
          Returns the default for synchronous or asynchronous behavior of state-changing methods.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          For Listeners which can refuse some values to be set.
 void setLocalReturn(boolean returnMode)
          Controls the behaviour of value-returning Methods.
 void setValue(double value)
          Set this Actuator to the value given as a parameter.
 void setValue(double value, boolean waitForCompletion)
          Set this Actuator to the Value given as a parameter.
 void setWaitForCompletion(boolean waitMode)
          Controls when state-changing Methods return.
 
Methods inherited from interface de.jaetzold.art.Sensor
addPropertyChangeListener, addSensorListener, connectWith, disconnect, getIntValue, getPort, getPrecision, getSensorPort, getValue, isConnected, processEvent, propertyChange, removePropertyChangeListener, removeSensorListener, update
 

Method Detail

setValue

public void setValue(double value)
Set this Actuator to the value given as a parameter. If this Actuator is connected with an ActuatorPeer the Peer is informed about this, otherwise an Exception might be thrown.
Parameters:
value - the value this Actuator should have.
Throws:
NotConnectedException - if this Actuator has no Peer or the Peer itself isn't connected (e.g. because the connection to the hardware went down)
See Also:
setValue(double,boolean), setWaitForCompletion(boolean)

setValue

public void setValue(double value,
                     boolean waitForCompletion)
Set this Actuator to the Value given as a parameter. If waitForCompletion is false this method may return before the new value has been sent to the hardware. This way the method could return almost immediatly and informing the peer and thus the hardware may happen asynchronous. If for some reason the value is not o.k. for this Actuator it is not required to accept the value and it is also not required to report that through an Exception. It may fail for example if one of the registered VetoableChangeListener-instances vetoes. In this case the method should return without changing anything.
Parameters:
value - the value this Actuator should have.
waitForCompletion - whether this method may set the value asynchronous.
Throws:
NotConnectedException - if this Actuator has no Peer or the Peer itself isn't connected (e.g. because the connection to the hardware went down)
See Also:
setWaitForCompletion(boolean), setValue(double), Sensor.isConnected(), addVetoableChangeListener(VetoableChangeListener)

setWaitForCompletion

public void setWaitForCompletion(boolean waitMode)
Controls when state-changing Methods return. If waitMode is true, every Method which changes the state of the Actuator should per default wait until the update in the Hardware-Interface had happened. This does not block the Method from returning because of a timeout. Setting this to false means the calls can happen asynchronous (but retain order).
Parameters:
waitMode - whether state-changing methods may return immediately
See Also:
setValue(double), ActuatorPeer.setValue(double,boolean)

getWaitForCompletion

public boolean getWaitForCompletion()
Returns the default for synchronous or asynchronous behavior of state-changing methods.
See Also:
setWaitForCompletion(boolean)

setLocalReturn

public void setLocalReturn(boolean returnMode)
Controls the behaviour of value-returning Methods. If it is true, every Method returns the value this Actuator wants the Hardware-Output to resemble. If it is false the value the Peer thinks this Hardware-Output really has is returned.
Parameters:
returnMode - whether value-returning methods should assume that the value last set is the one the Actuator really has.
See Also:
Sensor.getValue()

getLocalReturn

public boolean getLocalReturn()
Returns the whether value-returning methods assume no one else is using this Actuator.
See Also:
setLocalReturn(boolean)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
For Listeners which can refuse some values to be set. This is for now not really used and tested in ART, but at least RawActuator makes takes these listeners into account.
See Also:
RawActuator.setValue(double)

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
For Listeners which can refuse some values to be set.
See Also:
addVetoableChangeListener(VetoableChangeListener)