stella.parameter
Class CountDownWatch

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


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  long countdown
          The count-down start value.
private static boolean DEFAUTOSTART
          The default auto-start behaviour.
private static long DEFCOUNTDOWN
          The default count-down value.
static String KEY_AUTOSTART
          If true, the countdown starts after construction.
static String KEY_COUNTDOWN
          The count-down value.
 
Fields inherited from class stella.parameter.StopWatch
KEY_INIT, KEY_TIME
 
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
CountDownWatch(Map<String,String> prop)
          Constructs a new count-down watch.
 
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.StopWatch
getFormatted, isCounting, preserve, registerParameter, reset, restart, restore, setValue, start, stop
 
Methods inherited from class stella.parameter.AbstractValue
get, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, 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, 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.ExitCleaning
exit
 
Methods inherited from interface util.Reloadable
reload
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

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.

Constructor Detail

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.

Method Detail

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.