stella.parameter
Class PilarTrigger

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractCachedParameter
                      extended by stella.parameter.PilarParameter
                          extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static double DEFTRUE
          Default value class is Double.
static String KEY_FALSE
          The value that defines false.
static String KEY_TRUE
          The value that defines true.
private  SimpleTrigger state
          A helper to get further trigger functionality
 
Fields inherited from class stella.parameter.PilarParameter
KEY_DRIVERNAME, KEY_PILARGET
 
Fields inherited from class stella.parameter.AbstractCachedParameter
KEY_CACHE
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
PilarTrigger(Map<String,String> prop)
          Constructs a new pilar value from the properties.
 
Method Summary
 long getElapsedToggleTime()
          Returns the elapsed time from the last toggle event on the trigger until now.
 Date getLastToggleTime()
          Returns the date of the last toggle event on this trigger.
 Boolean getTrigger()
          Returns the same value as Parameter#get but already cast into a boolean.
protected  Object getUncached()
          Method called if cache is out of date.
 boolean isTrue()
          Returns the value of the trigger as a boolean primitive.
 Boolean setTrigger(Boolean to)
          Does the same thing as Parameter#set but returns the old value as a boolean.
 Boolean toggleTrigger()
          Toggles the value of this trigger.
 
Methods inherited from class stella.parameter.PilarParameter
registerDriver, rescanned, update
 
Methods inherited from class stella.parameter.AbstractCachedParameter
get, getCache, getCacheFormatted, set
 
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.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
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 class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.Parameter
get, getFormatted, getName, getString, set
 
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
 
Methods inherited from interface util.Initializable
init
 
Methods inherited from interface util.Reloadable
reload
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

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

Constructor Detail

PilarTrigger

public PilarTrigger(Map<String,String> prop)
Constructs a new pilar value from the properties.

Method Detail

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