stella.parameter
Class Jd

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.Jd
All Implemented Interfaces:
Cloneable, Parameter, Increasing<Number>, ParameterDepending, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying
Direct Known Subclasses:
AcceleratedJd

public class Jd
extends AbstractValue
implements Increasing<Number>, ParameterDepending, Reloadable

Represents the current time as julian date. Does not need the Time as a registered variable. Is meant as a convenience replacement for the more generic Time global. Note that this class can be easily tailored for the use of mjd. Providing a properties object which a specifies the key KEY_BASEJD pointing to 40587 makes the jd global produce mjd. Note that the key KEY_BASEJD points to the jd, mjd, tjd, of Jan. 1st 1970, 0h00 GMT.


Nested Class Summary
static class Jd.Test
          Test class.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
protected  double base
          The private copy of the base jd as a double.
static double DEFBASEJD
          The default jd of Jan.
static String DEFNAME
          The name of this global (jd).
private static String DEFTIME
          The name of the time global.
private static DecimalFormat df
          The jd-formatter.
static String KEY_BASEJD
          The key mapping to the jd of Jan.
static String KEY_TIME
          The name of the latitude to use.
private  Time time
          The time parameter, if registered.
 
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
Jd(Map define)
          Constructs a new global representing julian date.
 
Method Summary
 Double getAscendTime(Number until)
          Returns the remaining time in ms.
static double getJd(Date f)
          Static access for converting a date into a standard JD.
static double getJd(long ms)
          Static access for converting a unix time stamp into a standard JD.
 Number getValue()
          Returns the actual jd as a double.
 void registerParameter(Parameter curtime)
          A parameter depending command should drain the necessarry information to get valid out of a parameter value.
 double rescanned(String key, String old, String newval)
          It is not possible to rescan the time parameter name.
 Number setValue(Number val)
          Sets the jd.
 
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, 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 util.Reloadable
reload
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
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.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_BASEJD

public static final String KEY_BASEJD
The key mapping to the jd of Jan. 1st 1970, 0h00 GMT.

See Also:
Constant Field Values

KEY_TIME

public static final String KEY_TIME
The name of the latitude to use.

See Also:
Constant Field Values

DEFTIME

private static final String DEFTIME
The name of the time global.

See Also:
Constant Field Values

DEFBASEJD

public static final double DEFBASEJD
The default jd of Jan. 1st 1970, 0h00 GMT. (2440587.5)

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
The name of this global (jd).

See Also:
Constant Field Values

df

private static final DecimalFormat df
The jd-formatter.


base

protected double base
The private copy of the base jd as a double.


time

private Time time
The time parameter, if registered.

Constructor Detail

Jd

public Jd(Map define)
Constructs a new global representing julian date. Providing a properties object that maps the KEY_BASEJD to 40587 makes this object produce mjd.

Method Detail

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
It is not possible to rescan the time parameter name. All other return 1.

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

registerParameter

public void registerParameter(Parameter curtime)
Description copied from interface: ParameterDepending
A parameter depending command should drain the necessarry information to get valid out of a parameter value. During rendering, parameter depending commands should receive their data through this method. Note that it is always possible to pile up all the information needed for a single command in a single parameter.

Specified by:
registerParameter in interface ParameterDepending

setValue

public Number setValue(Number val)
                throws UnsupportedOperationException
Sets the jd. Jd is a read-only variable, therefore this method throws an UnsupportedOperationException.

Specified by:
setValue in interface Value
Throws:
UnsupportedOperationException

getValue

public Number getValue()
Returns the actual jd as a double. The precision should reach ms.

Specified by:
getValue in interface Value

getJd

public static double getJd(Date f)
Static access for converting a date into a standard JD.


getJd

public static double getJd(long ms)
Static access for converting a unix time stamp into a standard JD.


getAscendTime

public Double getAscendTime(Number until)
Returns the remaining time in ms.

Specified by:
getAscendTime in interface Increasing<Number>
Parameters:
until - A Number carrying the date
Returns:
A double carrying the remaining time or null if the time cannot be calculated.