Class InteractorPolicy

All Implemented Interfaces:

public class InteractorPolicy
extends AbstractStatePolicy

Default state update policy for use with the standard interactor state values and flags (see InteractorFlag and InteractorFlags). This state policy is stateless and employs fail-fast enforcement, throwing an exception if an invalid state occurs.

$Revision: 1.2 $
Jon Barrilleaux ( of JMB and Associates Inc.

Constructor Summary
protected InteractorPolicy()
          Creates an instance.
Method Summary
protected  void checkNewFlags(java.util.Collection flags)
          Called by this policy to check new state value flag types.
protected  void checkNewState(java.util.Set state)
          Only checks new flags; old flags are ignored (stateless).
static InteractorPolicy getInstance()
          Gets the singleton instance of this class.
 boolean isCompatible(StatePolicy policy)
          Returns true if another policy is assignment compatible with this policy.
Methods inherited from class gumbo.util.state.AbstractStatePolicy
checkInitialState, checkTransitState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


protected InteractorPolicy()
Creates an instance. Typically, this class is used as a singleton (see getInstance()). As such, this constructor is only used to extend the class.

Method Detail


protected void checkNewFlags(java.util.Collection flags)
Description copied from class: AbstractStatePolicy
Called by this policy to check new state value flag types. Modify the flags or throw an exception if a flag is invalid.

Specified by:
checkNewFlags in class AbstractStatePolicy
java.lang.IllegalStateException - Flags must be type InteractorFlag.


protected void checkNewState(java.util.Set state)
Only checks new flags; old flags are ignored (stateless). Checks for bad flags (???_NONE not allowed), exclusive-or flags (none or one ???_XOR_MASK flag set), and mutually exclusive flags (one and only one ???_ONE_MASK flag set) for each flag group (ACTION_???, CONTROL_???, STATUS_???, SELECT_???). Note that there are no restrictions on select flags other than that imposed by the identity of the select flags in a state set (only one select flag with a given subtype, order, and data model).

Specified by:
checkNewState in class AbstractStatePolicy
state - Reference to the new state (Object). Never null.
java.lang.IllegalStateException - ???_NONE flags not allowed.


public boolean isCompatible(StatePolicy policy)
Returns true if another policy is assignment compatible with this policy.

Specified by:
isCompatible in interface StatePolicy
isCompatible in class AbstractStatePolicy
policy - Other state policy. None if null.
True if the other policy (or the lack of a policy, if policy is null) is compatible with this one.


public static InteractorPolicy getInstance()
Gets the singleton instance of this class.

Reference to the singleton instance. Never null.