stella.parameter
Class SeasonWeather

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractTrigger
                      extended by stella.parameter.SimpleTrigger
                          extended by stella.parameter.SeasonWeather
All Implemented Interfaces:
Cloneable, Parameter, ParameterDepending, Trigger, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class SeasonWeather
extends SimpleTrigger
implements ParameterDepending

A trigger that mimics seasonal weather on the STELLA site. Whenever queried, it defines the current weather by matching the current time to a yes/no answer for good weather. It should use pre-recorded weather data from past year(s) to provide a seasonal match. Additionally, for a not-so coarse time-resolution, the solar-height parameter should be used.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Time current
          The time parameter.
private static double DEFHOLDTIME
          The default hold-time for bad-weather events in ms.
static String DEFNAME
          The default name of this parameter.
private static String DEFSEASON
          The default mapping of month-numbers to bad weather probabilities.
private static String DEFSOLHEIGHT
          The default solz-parameter.
private static String DEFTIME
          The default time parameter.
private static double DEFTWILIGHT
          The default toggle value for the solar height.
private static Calendar GREGORIAN
          We always use a gregorian calendar.
static String KEY_HOLDTIME
          The hold-time of bad-weather
static String KEY_SEASON
          The month-to-bad-weather probabilities as a look-up table.
static String KEY_SOLHEIGHT
          The key mapping to the solz-paramter.
static String KEY_TIME
          The key mapping to the time paramter.
static String KEY_TWILIGHT
          The trigger value for the solz-parameter.
private  double lasttime
          The value of the time parameter when last queried.
private  SolHeight solz
          The solar height.
private  Map weather
          The mapping of month numbers to probabilities.
 
Fields inherited from class stella.parameter.SimpleTrigger
KEY_INITBOOLEAN
 
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
SeasonWeather(Map prop)
          Contructs a new season weather.
 
Method Summary
 Boolean getTrigger()
          Returns the extrapolated weather as a boolean.
 void registerParameter(Parameter what)
          Registers additional parameters.
 double rescanned(String key, String old, String newval)
          As any parameter depending instance we fail if the parameter we depend on is now a different one.
 
Methods inherited from class stella.parameter.SimpleTrigger
getLastToggleTime, init, setTrigger
 
Methods inherited from class stella.parameter.AbstractTrigger
get, getElapsedToggleTime, isTrue, set, toggleTrigger
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, 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.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_TIME

public static final String KEY_TIME
The key mapping to the time paramter.

See Also:
Constant Field Values

KEY_SOLHEIGHT

public static final String KEY_SOLHEIGHT
The key mapping to the solz-paramter.

See Also:
Constant Field Values

KEY_TWILIGHT

public static final String KEY_TWILIGHT
The trigger value for the solz-parameter.

See Also:
Constant Field Values

KEY_HOLDTIME

public static final String KEY_HOLDTIME
The hold-time of bad-weather

See Also:
Constant Field Values

KEY_SEASON

public static final String KEY_SEASON
The month-to-bad-weather probabilities as a look-up table.

See Also:
Constant Field Values

DEFNAME

public static final String DEFNAME
The default name of this parameter.

See Also:
Constant Field Values

DEFTIME

private static final String DEFTIME
The default time parameter.

See Also:
Constant Field Values

DEFSOLHEIGHT

private static final String DEFSOLHEIGHT
The default solz-parameter.

See Also:
Constant Field Values

DEFTWILIGHT

private static final double DEFTWILIGHT
The default toggle value for the solar height.

See Also:
Constant Field Values

DEFHOLDTIME

private static final double DEFHOLDTIME
The default hold-time for bad-weather events in ms.

See Also:
Constant Field Values

DEFSEASON

private static final String DEFSEASON
The default mapping of month-numbers to bad weather probabilities.

See Also:
Constant Field Values

GREGORIAN

private static final Calendar GREGORIAN
We always use a gregorian calendar.


weather

private Map weather
The mapping of month numbers to probabilities.


current

private Time current
The time parameter.


lasttime

private double lasttime
The value of the time parameter when last queried.


solz

private SolHeight solz
The solar height.

Constructor Detail

SeasonWeather

public SeasonWeather(Map prop)
Contructs a new season weather. All keys have default values.

Method Detail

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
As any parameter depending instance we fail if the parameter we depend on is now a different one.

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

registerParameter

public void registerParameter(Parameter what)
Registers additional parameters. This parameter needs a time and the solar hight to deduce the current weather conditions.

Specified by:
registerParameter in interface ParameterDepending

getTrigger

public Boolean getTrigger()
Returns the extrapolated weather as a boolean. True is returned if weather is good.

Specified by:
getTrigger in interface Trigger
Overrides:
getTrigger in class SimpleTrigger