net.openai.util.fsm
Class Condition

java.lang.Object
  |
  +--net.openai.util.fsm.Condition
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AnyCondition, BooleanCondition, ComparableCondition, EqualsCondition

public abstract class Condition
extends java.lang.Object
implements java.io.Serializable

This is the base class for all Conditions

See Also:
Serialized Form

Constructor Summary
Condition()
          Constructs a new Condition object.
Condition(State targetState)
          Constructs a new Condition with the given target state.
 
Method Summary
 java.util.Vector getSourceStates()
          Returns a handle to the source States of this Condition.
 State getTargetState()
          Returns a handle to this Condition's current target state.
abstract  boolean satisfiedBy(java.lang.Object conditional)
          Called to check if the conditional meets the criteria defined by this state.
 void setTargetState(State targetState)
          Sets the target state for this Condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition()
Constructs a new Condition object.


Condition

public Condition(State targetState)
Constructs a new Condition with the given target state.

Parameters:
targetState - The target state for this Condition.
Method Detail

setTargetState

public final void setTargetState(State targetState)
Sets the target state for this Condition. This is the state that will be the current state in the machine if this Condition is met.

NOTE: If the target state is null whenever this condition is being checked by the machine and it passes, then the result will be an UnhandledConditionException being thrown by the machine. Setting this to null is allowed because it will be necessary within a Graphical Building tool such as bean box or the planned extensions to the net.openai.gui.graph package.

Parameters:
targetState - The new target state.

getTargetState

public final State getTargetState()
Returns a handle to this Condition's current target state.

Returns:
This Condition's target state.

getSourceStates

public final java.util.Vector getSourceStates()
Returns a handle to the source States of this Condition. The source States are the State that will check this Condition to see if it meets the criterial passed in and then go on to the target State.

Returns:
The source states of this Condition or null if there are none.

satisfiedBy

public abstract boolean satisfiedBy(java.lang.Object conditional)
Called to check if the conditional meets the criteria defined by this state. This is the only method to implement in order to used this interface.

Parameters:
conditional - The object to check.
Returns:
Implementors should return true if this condition is met by the Object conditional and false otherwise.


Copyright - 2001 OpenAI Labs. All Rights Reserved.