stella.parameter
Class CountDownWatch
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractValue
stella.parameter.StopWatch
stella.parameter.CountDownWatch
- All Implemented Interfaces:
- Cloneable, Parameter, StatePreserving, ParameterDepending, Value, ExitCleaning, Initializable, LocalizedSupplying, Preserving, PropertySupplying, Reloadable, ResourceSupplying
- Direct Known Subclasses:
- ExposureTimeLeft, TrackTime
public class CountDownWatch
- extends StopWatch
A count down acts more or less like a stop watch, but in the way that it
is not counting up, but counting down. If the StopWatch.start() method is
called without setting a setCountDown(long), it will start counting down
from the value KEY_COUNTDOWN. If the KEY_AUTOSTART
property is set, the count down will begin right after construction.
The value retrieved is always the remaining time.
|
Method Summary |
long |
getCountDown()
Returns the starting value of the count down. |
Number |
getValue()
Returns the current count-down value. |
double |
rescanned(String key,
String old,
String newval)
If the countdown value changed or the autostart changed, we update the
count down value or start the watch. |
void |
setCountDown(long newcount)
Sets a new count-down value. |
| Methods inherited from class stella.parameter.AbstractParameter |
createParameter, delivers, exit, 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_COUNTDOWN
public static final String KEY_COUNTDOWN
- The count-down value. Can be overridn with
setCountDown(long).
- See Also:
- Constant Field Values
KEY_AUTOSTART
public static final String KEY_AUTOSTART
- If true, the countdown starts after construction.
- See Also:
- Constant Field Values
DEFCOUNTDOWN
private static final long DEFCOUNTDOWN
- The default count-down value.
- See Also:
- Constant Field Values
DEFAUTOSTART
private static final boolean DEFAUTOSTART
- The default auto-start behaviour.
- See Also:
- Constant Field Values
countdown
private long countdown
- The count-down start value.
CountDownWatch
public CountDownWatch(Map<String,String> prop)
- Constructs a new count-down watch. The count-down value is set to
KEY_COUNTDOWN (DEFCOUNTDOWN if not given). If the
KEY_AUTOSTART property is true, the countdown starts right
after the construction phase.
rescanned
public double rescanned(String key,
String old,
String newval)
- If the countdown value changed or the autostart changed, we update the
count down value or start the watch.
- Specified by:
rescanned in interface Reloadable- Overrides:
rescanned in class StopWatch
getValue
public Number getValue()
- Returns the current count-down value. The current value of the stop
watch is therefore subtracted from the count-down start value,
countdown. Time is in ms.
- Specified by:
getValue in interface Value- Overrides:
getValue in class StopWatch
setCountDown
public void setCountDown(long newcount)
- Sets a new count-down value. May also be called during an active
count-down.
getCountDown
public long getCountDown()
- Returns the starting value of the count down. Time is in ms.