stella.parameter
Class ElapsedTime
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractValue
stella.parameter.ElapsedTime
- All Implemented Interfaces:
- Cloneable, Parameter, ParameterDepending, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying
public class ElapsedTime
- extends AbstractValue
- implements ParameterDepending, Reloadable
An elapsed time is a value linked to a trigger. If queried, it returns
the triggers last toggle time, negative if the trigger itself is false,
positive Long if the trigger is true. It is intended for making trigger
times available as values, think of querying the time a lamp was turned
on.
To properly work, the underlying trigger must be registered to this value,
thus the class implements the ParameterDepending interface. The
KEY_ELAPSED property must piont to the trigger of the given name.
|
Field Summary |
static String |
KEY_ELAPSED
The trigger that is observed in this value. |
private Trigger |
monitor
The trigger whose elapsed toggel tiem is monitored by this number. |
|
Constructor Summary |
ElapsedTime(Map prop)
Constructs a new elapsed time parameter. |
| 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_ELAPSED
public static final String KEY_ELAPSED
- The trigger that is observed in this value.
- See Also:
- Constant Field Values
monitor
private Trigger monitor
- The trigger whose elapsed toggel tiem is monitored by this number.
ElapsedTime
public ElapsedTime(Map prop)
- Constructs a new elapsed time parameter. The properties handed over must
specify the name of this value and the name of the trigger that is
observed.
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 observe)
- Registers the trigger named
KEY_ELAPSED to this value.
- Specified by:
registerParameter in interface ParameterDepending
- See Also:
getValue
getValue
public Number getValue()
- If we have a trigger registered to this value, we return the triggers
elapsed toggle time. The sign of this value is determined by the value
of the trigger: If the trigger is true, we return a positive value,
otherwise a negative one. If no trigger was linked to this value, null
is returned.
- Specified by:
getValue in interface Value
setValue
public Number setValue(Number val)
throws UnsupportedOperationException
- Setting this value is only possible via setting its underlying trigger.
- Specified by:
setValue in interface Value
- Throws:
UnsupportedOperationException