stella.parameter
Class SumWatch

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

public class SumWatch
extends AbstractValue
implements ParameterDepending, AfterRegistering, Reloadable

A sum watch takes several StopWatches and returns their summed value on request.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String KEY_SUMUP
          The list of names of stop watches to add.
private  List watches
          The list of truely registered watches.
private  List wish
          The list of watches we want.
 
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
SumWatch(Map prop)
          Constructs a new observation time.
 
Method Summary
 void afterAll()
          If we have still some watches left that have not been registered, yell now.
 Number getValue()
          Sums all watches and returns their values.
 void init()
          Initializes the list of requested watches.
 void registerParameter(Parameter part)
          Registers a new stop watch to this parameter.
 double rescanned(String key, String old, String newval)
          Exception, if watches change.
 Number setValue(Number val)
          Sets the current total time.
 
Methods inherited from class stella.parameter.AbstractValue
get, 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_SUMUP

public static final String KEY_SUMUP
The list of names of stop watches to add.

See Also:
Constant Field Values

wish

private List wish
The list of watches we want.


watches

private List watches
The list of truely registered watches.

Constructor Detail

SumWatch

public SumWatch(Map prop)
Constructs a new observation time. It is not started or stopped itself, it merely adds individual stop watch times to a total time.

Method Detail

init

public void init()
Initializes the list of requested watches. After registering, all of the watches should have been added, otherwise a warning is issued.

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

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
Exception, if watches change.

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

afterAll

public void afterAll()
If we have still some watches left that have not been registered, yell now.

Specified by:
afterAll in interface AfterRegistering

registerParameter

public void registerParameter(Parameter part)
Registers a new stop watch to this parameter. Only if it is listed in KEY_SUMUP and has not already been registered, the watch is added.

Specified by:
registerParameter in interface ParameterDepending

setValue

public Number setValue(Number val)
                throws UnsupportedOperationException
Sets the current total time. This is a read-only variable, therefore this method throws an UnsupportedOperationException.

Specified by:
setValue in interface Value
Throws:
UnsupportedOperationException

getValue

public Number getValue()
Sums all watches and returns their values.

Specified by:
getValue in interface Value