public abstract class WatchController extends AbstractParameter implements ParameterDepending, AfterRegistering
RollOverWatches. It is a parameter that registers additional
parameters that are instances of RollOverWatch, if they are
accepted with the KEY_ACCEPT. A roll-over watch is accepted, if
it's flavour matches this controller's KEY_ACCEPT key.
Note that all roll-over
watches are reset initially at a date derived from the KEY_COARSE
and the KEY_T0 properties in a way that the first roll-over date is
that that minizes the integer n in
f(t) = n*coarse+t0-t,with f(t)>0. E.g. if the
KEY_COARSE points to 86400000 (ms) and
KEY_T0 to 2000-01-01 12:00:00, then the first roll-over will occur
on noon the next following day.| Modifier and Type | Class and Description |
|---|---|
protected class |
WatchController.ResetTask
A timer task that simply resets the roll-over watch passed to it as a
constructor argument.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFCOARSE
The default coarseness.
|
private static SimpleDateFormat |
DEFDATEFORMAT
The default date format to use.
|
private static String |
DEFT0
The default date.
|
static String |
KEY_ACCEPT
A key defining the flavour of roll-over watches to accept.
|
static String |
KEY_COARSE
A key defining the coarseness of the first roll-over.
|
static String |
KEY_DATEFORMAT
The date format to use with
KEY_T0. |
static String |
KEY_T0
An offset for the first roll-over.
|
private static Timer |
reset
The timer to controll roll-overs of registered watches.
|
private List<RollOverWatch> |
watches
The list of all roll-over watches controlled by this controller.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Modifier | Constructor and Description |
|---|---|
protected |
WatchController(Map<String,String> prop)
Constructs a new watch controller.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterAll()
Initializes this watch controllers.
|
protected List<RollOverWatch> |
getWatches()
Returns all the roll-over watches served by this parameter.
|
void |
registerParameter(Parameter iswatch)
Registers an additional parameter.
|
protected double |
rescanned(String key,
String old,
String newval)
We throw an exception if the watches changed.
|
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, overrideDefaultName, register, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, 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, stringPropertiesinitpublic static final String KEY_ACCEPT
public static final String KEY_COARSE
public static final String KEY_T0
KEY_DATEFORMAT.public static final String KEY_DATEFORMAT
KEY_T0.private static final long DEFCOARSE
private static final String DEFT0
private static final SimpleDateFormat DEFDATEFORMAT
private final List<RollOverWatch> watches
private static Timer reset
protected WatchController(Map<String,String> prop)
KEY_COARSE, the
KEY_T0 and the KEY_DATEFORMAT properties asume their
default values if not specified.protected double rescanned(String key, String old, String newval)
rescanned in class AbstractParameterpublic void afterAll()
watches
is scheduled-at-fixed-rate to reset each
RollOverWatch.getRollOverTime(), starting at a date defined with
KEY_COARSE and KEY_T0.
Note that a roll-over time of zero means no roll-over
at all, not even an initial roll-over.afterAll in interface AfterRegisteringpublic void registerParameter(Parameter iswatch)
KEY_ACCEPT matches the flavour of the watch, it is reset by
this watch controller every RollOverWatch.getRollOverTime(),
starting at a date defined by KEY_COARSE and
KEY_T0. Note that a roll-over time of zero means no roll-over
at all, not even an initial roll-over.registerParameter in interface ParameterDependingprotected List<RollOverWatch> getWatches()
RollOverWatch instances.