public class TimeSimulate extends CurrentTime implements Simulating, ParameterDepending
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private double |
accelerate
Acceleration factor.
|
private long |
faketime
The time faked at simul start.
|
static String |
KEY_DUSKSTART
If present, only the day is deduced from offset time from twilight.
|
static String |
KEY_FORDATE
The key mapping to the date format to use.
|
static String |
KEY_OFFSET
The key mapping to the starting time offset of the accelerated time.
|
private Longitude |
lambda
For twilight fakes, this is the longitude.
|
private Latitude |
phi
For twilight fakes, this is the latitude.
|
private long |
simulstart
The time simulation started.
|
DEFNAMEISO, ISOSTANDARD, UTCKEY_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| Constructor and Description |
|---|
TimeSimulate(Map<String,String> prop) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accelerate(double by) |
Number |
getValue()
If we are in simulating mode, we calculate the simulated time by
accelerating the time passed since simulation start and adding this
adjusted span to the fake time deduced on simulation start.
|
private long |
nextDusk(double height,
double lambda,
double phi) |
void |
registerParameter(Parameter p)
If parameter is a latitude or a longitude, we keep it for calculating
dusk simulation times.
|
boolean |
startSimulate()
On simulation start we try to deduce the time we should point to by going
through the following list, stopping whenever a match is obtained:
If
KEY_DUSKSTART is set and we have a valid registered
longitude and latitude, we calculate the next time the sun will reach the
twilight (sun height) as stated in this property. |
boolean |
stopSimulate() |
getAscendTime, getTime, isCompletedgetFormatted, rescanned, setValueget, setcreateParameter, delivers, exit, 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, stringPropertiesinitreloadpublic static final String KEY_OFFSET
public static final String KEY_DUSKSTART
public static final String KEY_FORDATE
private long simulstart
private long faketime
private double accelerate
private Longitude lambda
private Latitude phi
public void registerParameter(Parameter p)
registerParameter in interface ParameterDependingpublic boolean startSimulate()
KEY_DUSKSTART is set and we have a valid registered
longitude and latitude, we calculate the next time the sun will reach the
twilight (sun height) as stated in this property. The simulated time is
now the time at dusk.KEY_OFFSET is set, we add it to the current system
time and call this the current time.KEY_FORDATE is set, we convert this ISO-date into a time
and start the simulated time from here.startSimulate in interface Simulatingprivate long nextDusk(double height,
double lambda,
double phi)
public boolean stopSimulate()
stopSimulate in interface Simulatingpublic boolean accelerate(double by)
throws UnsupportedOperationException
accelerate in interface SimulatingUnsupportedOperationExceptionpublic Number getValue()
getValue in interface ValuegetValue in class CurrentTimestartSimulate()