gumbo.util.state
Class AbstractStateTrigger

java.lang.Object
  |
  +--gumbo.util.state.AbstractStateTrigger

Deprecated. StateSet has no events.

public abstract class AbstractStateTrigger
extends java.lang.Object

An abstract base class for a trigger that fires when a state update condition is satisfied. To implement a concrete trigger, provide a means for establishing and testing the trigger conditions, and for notifying event listeners when the trigger has fired.

Typically, triggers can be level or edge sensing. Level triggers can fire on high (flags set) or low (flags not set) conditions; whereas, edge triggers can fire on rising (flags added), falling (flags removed), or changing (flags changed) conditions.

Todo: Finish replacing methods with event fields.

Version:
$Revision: 1.2 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Constructor Summary
AbstractStateTrigger()
          Deprecated. Constructs an instance, that is multi-shot and enabled.
AbstractStateTrigger(boolean multiShot, boolean enable)
          Deprecated. Constructs an instance, as specified.
 
Method Summary
 boolean getMultiShotMode()
          Deprecated. Gets whether or not multi-shot mode is enabled.
 StateSetField.EventIn getStateResetIn()
          Deprecated. Receives an event when a source state set resets, whether or not the state value changed.
 StateSetField.EventIn getStateTransitIn()
          Deprecated. Receives an event when a source state set transits, whether or not the state value changed.
 boolean getTriggerEnable()
          Deprecated. Gets whether or not this trigger is enabled for firing.
 boolean hasTriggerFired()
          Deprecated. Gets this trigger's firing state.
protected abstract  void notifyTriggerFired()
          Deprecated. Called by the system each time this trigger fires, in which case the trigger listeners should be notified accordingly.
protected abstract  void notifyTriggerReset()
          Deprecated. Called by the system when this trigger had fired and is reset, in which case the trigger listeners should be notified accordingly.
 void resetTriggerFired()
          Deprecated. Resets this trigger's firing state, even if the trigger is disabled.
 void setMultiShotMode(boolean multiShot)
          Deprecated. Sets whether or not multi-shot mode is enabled.
 void setTriggerEnable(boolean enable)
          Deprecated. Sets whether or not this trigger is enabled for firing.
protected abstract  boolean testTriggerCondition(java.util.Set newState, java.util.Set oldState)
          Deprecated. Called by the system when a monitored state value has been updated (whether or not it has changed) and the trigger condition needs to be tested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStateTrigger

public AbstractStateTrigger()
Deprecated. 
Constructs an instance, that is multi-shot and enabled.


AbstractStateTrigger

public AbstractStateTrigger(boolean multiShot,
                            boolean enable)
Deprecated. 
Constructs an instance, as specified.

Parameters:
multiShot - If true, the trigger mode is multi-shot (see setMultiShotMode()).
enable - If true, the trigger is immediately enabled.
Method Detail

getStateResetIn

public StateSetField.EventIn getStateResetIn()
Deprecated. 
Receives an event when a source state set resets, whether or not the state value changed. If the trigger is disabled, or the trigger type is one shot and the trigger has already fired, nothing happens. Otherwise, testTriggerConditions() is called and, if it returns true, the trigger is fired and notifyTriggerFired() is called.


getStateTransitIn

public StateSetField.EventIn getStateTransitIn()
Deprecated. 
Receives an event when a source state set transits, whether or not the state value changed. If the trigger is disabled, or the trigger type is one shot and the trigger has already fired, nothing happens. Otherwise, testTriggerConditions() is called and, if it returns true, the trigger is fired and notifyTriggerFired() is called.


setMultiShotMode

public void setMultiShotMode(boolean multiShot)
Deprecated. 
Sets whether or not multi-shot mode is enabled.

Parameters:
multiShot - If true, this trigger will fire each time the trigger condition is satisfied; otherwise, the trigger has to be reset after each firing in order to fire again.

getMultiShotMode

public boolean getMultiShotMode()
Deprecated. 
Gets whether or not multi-shot mode is enabled.


setTriggerEnable

public void setTriggerEnable(boolean enable)
Deprecated. 
Sets whether or not this trigger is enabled for firing.

Parameters:
enable - If true, this trigger is reset and then enabled/re-enabled for firing; otherwise, the trigger is disabled from firing.

getTriggerEnable

public boolean getTriggerEnable()
Deprecated. 
Gets whether or not this trigger is enabled for firing.

Returns:
If true, trigger is enabled.

resetTriggerFired

public void resetTriggerFired()
Deprecated. 
Resets this trigger's firing state, even if the trigger is disabled. If the trigger had fired, notifyTriggerReset() is called.


hasTriggerFired

public boolean hasTriggerFired()
Deprecated. 
Gets this trigger's firing state.

Returns:
If true, the trigger condition has been satisfied (at least once) since the trigger was last enabled or resetTriggerFired() was called.

testTriggerCondition

protected abstract boolean testTriggerCondition(java.util.Set newState,
                                                java.util.Set oldState)
Deprecated. 
Called by the system when a monitored state value has been updated (whether or not it has changed) and the trigger condition needs to be tested. Implementations can assume that the system has already considered the trigger mode and enable state.

Parameters:
newState - The new state value. Never null.
oldState - The old state value. Null if not available.
Returns:
True if the trigger condition has been satisfied; otherwise, false.

notifyTriggerFired

protected abstract void notifyTriggerFired()
Deprecated. 
Called by the system each time this trigger fires, in which case the trigger listeners should be notified accordingly.


notifyTriggerReset

protected abstract void notifyTriggerReset()
Deprecated. 
Called by the system when this trigger had fired and is reset, in which case the trigger listeners should be notified accordingly.