stella.parameter
Class InferPark

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractTrigger
                      extended by stella.parameter.InferPark
All Implemented Interfaces:
Cloneable, Parameter, ParameterDepending, Trigger, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class InferPark
extends AbstractTrigger
implements ParameterDepending, Reloadable

Tries to infer the parking state of the telescope by checking the telescope's power state and altitude. Park is assumed if the power is off and the telescope is close to the upright position.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Value alt
          The registered alt parameter.
private static String DEFALTITUDE
          The default name of the telescope altitude parameter.
static String DEFNAME
          The default name of this parameter.
private static String DEFPOWER
          The default name of the telescope power parameter.
private static double DEFVERTICALOFF
          The default vertical offset allowed.
static String KEY_ALTITUDE
          The name of the telescope altitude parameter.
static String KEY_POWER
          The name of the telescope power parameter.
static String KEY_VERTICALOFF
          The allowed offset from the vertical position still considered home.
private  Trigger power
          The registered power trigger.
 
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
InferPark(Map prop)
          Constructs a new park-telescope inferrer trigger.
 
Method Summary
 Date getLastToggleTime()
          Returns a very crude estimate by returning the toggle time of the power trigger.
 Boolean getTrigger()
          Returns true if power is off and telescope is upright.
 void registerParameter(Parameter what)
          Registers the telescope height and the telescope power state.
 double rescanned(String key, String old, String newval)
          As any parameter depending instance we fail if the parameter we depend on is now a different one.
 Boolean setTrigger(Boolean to)
          Setting the trigger is not allowed.
 
Methods inherited from class stella.parameter.AbstractTrigger
get, getElapsedToggleTime, isTrue, set, toggleTrigger
 
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 util.Reloadable
reload
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
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.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_VERTICALOFF

public static final String KEY_VERTICALOFF
The allowed offset from the vertical position still considered home.

See Also:
Constant Field Values

KEY_ALTITUDE

public static final String KEY_ALTITUDE
The name of the telescope altitude parameter.

See Also:
Constant Field Values

KEY_POWER

public static final String KEY_POWER
The name of the telescope power parameter.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
The default name of this parameter.

See Also:
Constant Field Values

DEFVERTICALOFF

private static final double DEFVERTICALOFF
The default vertical offset allowed.

See Also:
Constant Field Values

DEFALTITUDE

private static final String DEFALTITUDE
The default name of the telescope altitude parameter.

See Also:
Constant Field Values

DEFPOWER

private static final String DEFPOWER
The default name of the telescope power parameter.

See Also:
Constant Field Values

alt

private Value alt
The registered alt parameter.


power

private Trigger power
The registered power trigger.

Constructor Detail

InferPark

public InferPark(Map prop)
Constructs a new park-telescope inferrer trigger.

Method Detail

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
As any parameter depending instance we fail if the parameter we depend on is now a different one.

Specified by:
rescanned in interface Reloadable
Overrides:
rescanned in class AbstractParameter

registerParameter

public void registerParameter(Parameter what)
Registers the telescope height and the telescope power state.

Specified by:
registerParameter in interface ParameterDepending

getTrigger

public Boolean getTrigger()
Returns true if power is off and telescope is upright. Returns false, if either of the two parameters are not registered.

Specified by:
getTrigger in interface Trigger

setTrigger

public Boolean setTrigger(Boolean to)
Setting the trigger is not allowed.

Specified by:
setTrigger in interface Trigger

getLastToggleTime

public Date getLastToggleTime()
Returns a very crude estimate by returning the toggle time of the power trigger.

Specified by:
getLastToggleTime in interface Trigger