stella.parameter
Class TriggerStub

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.ParameterStub
                      extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class stella.parameter.ParameterStub
ParameterStub.Finger
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String KEY_UNCONNECTED
          If this is set, we return a boolean value even if not connected.
 
Fields inherited from class stella.parameter.ParameterStub
KEY_BLOCK, KEY_FORMATCLASS, KEY_FORMATPATTERN, KEY_INITTRY, KEY_REMOTENAME, KEY_RETRY, KEY_SERVERDELAY, KEY_WAIT, sensor
 
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
TriggerStub(Map prop)
          Constructs a new trigger stub.
TriggerStub(String remotename)
          For convenience, we support a constructor with only the remote name.
 
Method Summary
 Object get()
          Casts the parameter value retrieved with get() to a Boolean.
 long getElapsedToggleTime()
          Returns the elapsed time since the last toggle event.
 Date getLastToggleTime()
          Returns the time of the last toggle event as a date.
 Boolean getTrigger()
          Casts the parameter value retrieved with get() to a Boolean.
 boolean isTrue()
          Returns the value of this trigger already interpreted as a primitive boolean.
 Boolean setTrigger(Boolean to)
          Operation not allowed.
 Boolean toggleTrigger()
          Operation not allowed.
 
Methods inherited from class stella.parameter.ParameterStub
cancel, disconnect, exit, getAsociatedThread, getFormatted, init, isConnected, maxTimeToCancel, rebind, rescanned, run, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, 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 stella.Parameter
getFormatted, getName, getString, set
 
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.Reloadable
reload
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

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
Constructor Detail

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
Method Detail

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.