stella.parameter
Class PilarValue

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.PilarValue
All Implemented Interfaces:
DriverDepending, Cloneable, Parameter, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class PilarValue
extends PilarParameter
implements Value

Telescope parameters whose string representation can be parsed into a number


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFVALUECLASS
          Default value class is Double.
static String KEY_VALUECLASS
          The name of number class used to parse the parameter from.
private  Class<? extends Number> number
          We use this class for parsing strings to numbers.
 
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
PilarValue(Map<String,String> prop)
          Constructs a new pilar value from the properties.
 
Method Summary
 Number getValue()
          Gets the pilar response either from the cache or from the underlying telescope and trie to parse it into a Number.
 void init()
          On init, try to load our parser class.
private  boolean initParserClass()
          We try to use the parser class for converting string answers from the pilar driver to number instances.
 double rescanned(String key, String old, String newval)
          If the parser class changed, we try to rebuild it.
 Number setValue(Number to)
          Setting a number is not allowed.
 
Methods inherited from class stella.parameter.PilarParameter
getUncached, registerDriver, 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, 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.Reloadable
reload
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_VALUECLASS

public static final String KEY_VALUECLASS
The name of number class used to parse the parameter from.

See Also:
Constant Field Values

DEFVALUECLASS

private static final String DEFVALUECLASS
Default value class is Double.

See Also:
Constant Field Values

number

private Class<? extends Number> number
We use this class for parsing strings to numbers.

Constructor Detail

PilarValue

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

Method Detail

init

public void init()
On init, try to load our parser class.

Specified by:
init in interface Initializable
Overrides:
init in class AbstractParameter

initParserClass

private boolean initParserClass()
We try to use the parser class for converting string answers from the pilar driver to number instances. Defaults to Double class.

Returns:
True, if the class was found and is usable.

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
If the parser class changed, we try to rebuild it.

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

getValue

public Number getValue()
Gets the pilar response either from the cache or from the underlying telescope and trie to parse it into a Number. The number class can be specified in the properties.

Specified by:
getValue in interface Value

setValue

public Number setValue(Number to)
Setting a number is not allowed. This is done only within certain commands of a PilarDriver

Specified by:
setValue in interface Value