stella.parameter
Class SimpleTrigger

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
All Implemented Interfaces:
Cloneable, Parameter, Trigger, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying
Direct Known Subclasses:
AbstractSwitch, CountDownTrigger, CountingTrigger, DeviceTrigger, ErrorTrigger, FlatMatch, MomentsTrigger, OneReadTrigger, SeasonWeather, SimpleEventTrigger

public class SimpleTrigger
extends AbstractTrigger
implements Reloadable

A helper class providing a simple trigger. A parameter once set with the AbstractTrigger.set(java.lang.Object) method can be retrieved later with the AbstractTrigger.get() method. The only difference to the abstract trigger base class is that this class is not abstract and provides two public constructors.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String KEY_INITBOOLEAN
          The key for initializing the simple trigger to the given value.
private  Date toggle
          The date of the last toggle event on the trigger.
private  Boolean val
          The value of the paramter.
 
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
SimpleTrigger()
          Constructs a simple parameter without any properteis.
SimpleTrigger(boolean startval)
          Constructs a simple trigger without parameters and set to the startup value.
SimpleTrigger(Map prop)
          Constructs a simple parameter without any specific need for the properties argument.
 
Method Summary
 Date getLastToggleTime()
          Returns the time of the last toggle event as a date.
 Boolean getTrigger()
          Gets the value of this parameter.
 void init()
          Initializes this simple trigger and sets it to its initial state if the KEY_INITBOOLEAN property is set.
 double rescanned(String key, String old, String newval)
          Makes this method public and allows setting of the initial value of the trigger, if this is still null.
 Boolean setTrigger(Boolean newval)
          Sets the value of this parameter.
 
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_INITBOOLEAN

public static final String KEY_INITBOOLEAN
The key for initializing the simple trigger to the given value.

See Also:
Constant Field Values

val

private Boolean val
The value of the paramter.


toggle

private Date toggle
The date of the last toggle event on the trigger.

Constructor Detail

SimpleTrigger

public SimpleTrigger()
Constructs a simple parameter without any properteis.


SimpleTrigger

public SimpleTrigger(boolean startval)
Constructs a simple trigger without parameters and set to the startup value. The argumental primitive boolean is converted into a Boolean object.


SimpleTrigger

public SimpleTrigger(Map prop)
Constructs a simple parameter without any specific need for the properties argument.

Method Detail

init

public void init()
Initializes this simple trigger and sets it to its initial state if the KEY_INITBOOLEAN property is set.

Specified by:
init in interface Initializable
Overrides:
init in class AbstractParameter

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
Makes this method public and allows setting of the initial value of the trigger, if this is still null.

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

getTrigger

public Boolean getTrigger()
Gets the value of this parameter.

Specified by:
getTrigger in interface Trigger

setTrigger

public Boolean setTrigger(Boolean newval)
Sets the value of this parameter. If neither the old and the new value are null and the old value is not equal the new value, a the time of this trigger event is recorded.

Specified by:
setTrigger in interface Trigger
Returns:
The old value of the trigger.

getLastToggleTime

public Date getLastToggleTime()
Returns the time of the last toggle event as a date. If this trigger was never toggled, i.e. its state changed from one logical state to the other, null is returned.

Specified by:
getLastToggleTime in interface Trigger