stella.parameter
Class PilarTrigger
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractCachedParameter
stella.parameter.PilarParameter
stella.parameter.PilarTrigger
- All Implemented Interfaces:
- DriverDepending, Cloneable, Parameter, Trigger, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying
public class PilarTrigger
- extends PilarParameter
- implements Trigger
No true triggers (true/false) exist in Pilar, only values. The power
varibale, for instance, is 0 if the power is off, 1 if the power is on and
the telescope is ready yo observer, but unluckily there are intermittent
stages, like power=0.7, which means the power is not totally on, but also
not totally off. Normally, these intermittent stages occur during a
tran sition phase. For linking the power value to a trigger that says
telescope ready, the implementation should return false on any value
of power not equal one. This is the default behaviour of this parameter.
A similar behaviour is reached by setting the KEY_TRUE property
to any other value than the default one, than true will reported
only if the underlying pilar parameter has exactly the stated
value. If the KEY_FALSE property is set, true will be reported
on any reading that is not equal to the stated value. If both
keys are set, KEY_FALSE takes precedence. If no parameter
name is set, the mother constructor throws an exception.
String values are not allowed, as the parameter is always parsed into a
double.
The properties of this trigger are also use as the properties to construct
the helper SimpleTrigger, this means a default value of the
trigger, attainable a non-null value even if reading fails, is settable
via the SimpleTrigger.KEY_INITBOOLEAN property.
| Methods inherited from class stella.parameter.AbstractParameter |
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, register, setName, toString |
| Methods inherited from class util.PropertyResources |
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from interface util.PropertySupplying |
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
KEY_TRUE
public static final String KEY_TRUE
- The value that defines true.
- See Also:
- Constant Field Values
KEY_FALSE
public static final String KEY_FALSE
- The value that defines false.
- See Also:
- Constant Field Values
DEFTRUE
private static final double DEFTRUE
- Default value class is Double.
- See Also:
- Constant Field Values
state
private SimpleTrigger state
- A helper to get further trigger functionality
PilarTrigger
public PilarTrigger(Map<String,String> prop)
- Constructs a new pilar value from the properties.
getTrigger
public Boolean getTrigger()
- Returns the same value as
Parameter#get but already cast into a
boolean.
- Specified by:
getTrigger in interface Trigger
isTrue
public boolean isTrue()
- Returns the value of the trigger as a boolean primitive.
- Specified by:
isTrue in interface Trigger
setTrigger
public Boolean setTrigger(Boolean to)
throws UnsupportedOperationException
- Does the same thing as
Parameter#set but returns the old value
as a boolean.
- Specified by:
setTrigger in interface Trigger
- Throws:
UnsupportedOperationException
toggleTrigger
public Boolean toggleTrigger()
- Toggles the value of this trigger. This method does not have a
Parameter counterpart. The return value is the old value
of the trigger.
- Specified by:
toggleTrigger in interface Trigger
getLastToggleTime
public Date getLastToggleTime()
- Returns the date of the last toggle event on this trigger.
- Specified by:
getLastToggleTime in interface Trigger
getElapsedToggleTime
public long getElapsedToggleTime()
- Returns the elapsed time from the last toggle event on the trigger
until now. The returned time is a time in ms, passed over as a long.
- Specified by:
getElapsedToggleTime in interface Trigger
getUncached
protected Object getUncached()
- Method called if cache is out of date. We get the parent's class cache
value and try to parse the result to a trigger value.
- Overrides:
getUncached in class PilarParameter