stella.parameter
Class TriggerStub
java.lang.Object
util.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.ParameterStub
stella.parameter.TriggerStub
- All Implemented Interfaces:
- Cloneable, Runnable, Remote, Parameter, Trigger, CancelRunnable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying, RmiListener
- Direct Known Subclasses:
- SwitchStub
public class TriggerStub
- extends ParameterStub
- implements Trigger
An extension to parameter stub. This class casts the generic parameter stub
to a trigger stub, meaning that the parameter value retrieved from the
remote machine with RemoteParameter.remoteGet() is cast to
a boolean value. All the unique Trigger functionality is available.
|
Field Summary |
static String |
KEY_UNCONNECTED
If this is set, we return a boolean value even if not connected. |
|
Constructor Summary |
TriggerStub(Map prop)
Constructs a new trigger stub. |
TriggerStub(String remotename)
For convenience, we support a constructor with only the remote name. |
| Methods inherited from class stella.parameter.ParameterStub |
cancel, disconnect, exit, getAsociatedThread, getFormatted, init, isConnected, maxTimeToCancel, rebind, rescanned, run, set |
| 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_UNCONNECTED
public static final String KEY_UNCONNECTED
- If this is set, we return a boolean value even if not connected.
- See Also:
- Constant Field Values
TriggerStub
public TriggerStub(String remotename)
throws RemoteException
- For convenience, we support a constructor with only the remote name.
- Throws:
RemoteException
TriggerStub
public TriggerStub(Map prop)
throws RemoteException
- Constructs a new trigger stub. This trigger connects to a remote
parameter. The value retrieved must be of type Boolean.
- Throws:
RemoteException
getTrigger
public Boolean getTrigger()
- Casts the parameter value retrieved with
get() to a Boolean.
Does not check if the returned value is of type Boolean.
- Specified by:
getTrigger in interface Trigger
get
public Object get()
- Casts the parameter value retrieved with
get() to a Boolean.
Does not check if the returned value is of type Boolean.
- Specified by:
get in interface Parameter- Overrides:
get in class ParameterStub
isTrue
public boolean isTrue()
- Returns the value of this trigger already interpreted as a primitive
boolean. If the trigger was never set prior to this call, false is
returned.
- Specified by:
isTrue in interface Trigger
setTrigger
public Boolean setTrigger(Boolean to)
- Operation not allowed.
- Specified by:
setTrigger in interface Trigger
- Throws:
UnsupportedOperationException - always.
toggleTrigger
public Boolean toggleTrigger()
- Operation not allowed.
- Specified by:
toggleTrigger in interface Trigger
- Throws:
UnsupportedOperationException - always.
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. Calls the
RemoteTrigger.remoteToggleTime() method, without checking if
the remote counterpart is registered.
- Specified by:
getLastToggleTime in interface Trigger
getElapsedToggleTime
public long getElapsedToggleTime()
- Returns the elapsed time since the last toggle event. If this trigger
was never toggled, i.e. its state changed from one logical state to the
other, -1 is returned. If the system is acceleerated, we multiply the
elapsed time, simply because we are bound to another system with
unknown acceleration.
- Specified by:
getElapsedToggleTime in interface Trigger
- Returns:
- The time since the last toggle event, in ms.