stella.parameter
Class SimpleTrigger
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractTrigger
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.
|
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. |
|
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. |
| Methods inherited from class stella.parameter.AbstractParameter |
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, register, setName, toString |
| 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 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 |
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.
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.
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