public class SettableTime extends CurrentTime implements ParameterDepending, AfterRegistering
This class uses a dirty trick. By implementing the
WeatherDependingParameter interface, we get a hold of the weather
station that will be notified in case of time advances, if it supports this.
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static DateFormat |
DEFDATEFORMAT
The default date formatter.
|
private List<DateFormat> |
df
The list of date formatters to try.
|
static String |
KEY_DATEFORMAT
The key mapping to the date format to use.
|
static String |
KEY_DUSKSTART
If present, only the day is deduced from offset time from twilight.
|
static String |
KEY_OFFSET
The key mapping to the starting time offset of the accelerated time.
|
static String |
KEY_TIMEZONE
The key mapping to the time zone format to use.
|
private Longitude |
lambda
For twilight fakes, this is the longitude.
|
private long |
mstime
The time that should be faked.
|
private Latitude |
phi
For twilight fakes, this is the latitude.
|
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 |
|---|
SettableTime(Map<String,String> prop)
Constructs a new global representing a faked time.
|
| Modifier and Type | Method and Description |
|---|---|
void |
advance(long add)
Advances the time for the stated amount of milliseconds.
|
void |
afterAll()
For twilight times we are only ready once we have longitude and latitude.
|
Number |
getValue()
Returns the time as an Long object.
|
void |
init()
Initializes the parameter with its class name.
|
void |
registerParameter(Parameter p)
If parameter is a latitude or a longitude, we keep it.
|
double |
rescanned(String key,
String old,
String newval)
If offset or date format change, we act.
|
Object |
set(Object date)
Links the
Parameter.set(java.lang.Object) to the setDate(java.lang.String) method. |
void |
setDate(Date fake)
Sets a fake date.
|
boolean |
setDate(String fake)
Sets the fake time to the date represented by the argument string.
|
void |
setJd(double jd)
Sets a JD.
|
private void |
setMsTime(long ms) |
getAscendTime, getTime, isCompletedgetFormatted, setValuegetcreateParameter, delivers, exit, getFormatted, getName, getPreserveFile, getString, getString, 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, waitget, getFormatted, getName, getStringdefaultBoolean, 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, stringPropertiesreloadpublic static final String KEY_OFFSET
public static final String KEY_DUSKSTART
public static final String KEY_DATEFORMAT
public static final String KEY_TIMEZONE
private static final DateFormat DEFDATEFORMAT
private long mstime
private Longitude lambda
private Latitude phi
private List<DateFormat> df
public void init()
AbstractParameterinit in interface Initializableinit in class AbstractParameterpublic void afterAll()
afterAll in interface AfterRegisteringpublic void registerParameter(Parameter p)
registerParameter in interface ParameterDependingpublic double rescanned(String key, String old, String newval)
rescanned in interface Reloadablerescanned in class AbstractTimepublic Object set(Object date)
Parameter.set(java.lang.Object) to the setDate(java.lang.String) method.set in interface Parameterset in class AbstractValuepublic boolean setDate(String fake)
public void setDate(Date fake)
public void setJd(double jd)
private void setMsTime(long ms)
public void advance(long add)
public Number getValue()
setDate(java.lang.String) or advanced, using
advance(long).getValue in interface ValuegetValue in class CurrentTime