|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractValue
stella.parameter.StopWatch
public class StopWatch
A stop watch parameter counts elapsed time. The value it returns is always
a long, giving the totally elapsed time in ms. A stop watch can be halted
for an unlimited time with the stop() method. After a call to
start() it starts accumulating time again. To reset the time counter
to zero, call reset() which is an abreviation to setValue(java.lang.Number)
with a zero Long.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private Long |
acttime
The value of the stop watch at the last stop() call. |
private static long |
DEFINIT
The default initial time of the stop watch. |
private static String |
DEFTIME
The default name of the time to use. |
static String |
KEY_INIT
The key linked to a start value of the stop watch. |
static String |
KEY_TIME
The key linked to the name of the time to use. |
private long |
starttime
The long recording the time at a {link #start} call. |
private Value |
timer
The parameter denoting 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 | |
|---|---|
StopWatch(Map prop)
Constructs a new stop watch. |
|
| Method Summary | |
|---|---|
String |
getFormatted()
Formats the output to show seconds instead of milliseconds. |
private long |
getTime()
Returns the current time. |
Number |
getValue()
Gets the current value of the stop watch. |
boolean |
isCounting()
Returns true if the stop watch is currently running. |
boolean |
preserve()
Preserves the overall true time of the trigger. |
void |
registerParameter(Parameter time)
Registers the time parameter to this trigger. |
double |
rescanned(String key,
String old,
String newval)
It is not possible to rescan the time parameter name. |
void |
reset()
Resets the counter of the stop watch. |
void |
restart()
Resets the counter of the stop watch and starts it, if not already running. |
boolean |
restore()
Initializes the trigger. |
Number |
setValue(Number newval)
Sets the value of the stop watch. |
void |
start()
Stats the stop watch. |
void |
stop()
Stops the stop watch. |
| 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 |
|---|
public static final String KEY_INIT
public static final String KEY_TIME
private static final long DEFINIT
private static final String DEFTIME
private Value timer
private Long acttime
stop() call.
private long starttime
| Constructor Detail |
|---|
public StopWatch(Map prop)
DEFINIT. Accumulation will only start after a call to
start()
| Method Detail |
|---|
public double rescanned(String key,
String old,
String newval)
rescanned in interface Reloadablerescanned in class AbstractParameterpublic Number setValue(Number newval)
setValue in interface Valuepublic Number getValue()
starttime is
zero, acttime is returned. Otherwise - the stop watch is
running
- the value of acttime plus the difference between the current
time and the starttime is returned.
getValue in interface Valuepublic void registerParameter(Parameter time)
registerParameter in interface ParameterDependingpublic boolean restore()
restore in interface Preservingpublic boolean preserve()
preserve in interface Preservingpublic void start()
starttime is set to the
current time.
public void stop()
start() is added to the actual time.
To signal that the stop watch has stopped, the starttime is set
to zero.
public void reset()
setValue(java.lang.Number) with a zero-valued Long. The running/stoped state of
the watch is inaffected.
public void restart()
public boolean isCounting()
public String getFormatted()
getFormatted in interface ParametergetFormatted in class AbstractParameterprivate long getTime()
timer parameter has been set,
this time is used, otherwise the system time is grabbed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||