| |
All Packages Class Hierarchy This Package Previous Next Index
Class bvyy.smf.GeneralStateModel
java.lang.Object
|
+----bvyy.smf.StateMachine
|
+----bvyy.smf.GeneralStateModel
- public class GeneralStateModel
- extends StateMachine
Make a general purpose state model.
Intent
This is a generic state machine where the definition will be provided
from an external source such as data file.
There is an assumption in here that the state machine will have fewer
than the theoretically possible transitions. If it has more than say 80%
the I really need to write a highly meshed transition class.
Motivation
Allow the game desingers to specify state machines that I could not
have envisionaged. Maked the game customisable by a non-computer literate
author with no need to write code.
- Version:
- 0.0.3 24 May 1998
- Author:
- (c) 1998 Brian Voon Yee Yap
-
GeneralStateModel()
- Implements a one state state-machine default constructor.
-
addStateChange(String, String, String)
-
-
fireStateChange(ModifiableChangeEvent)
- Change the state from the current state to a new state.
-
GeneralStateModel(StringTokenizer)
- Produces a state machine according to the follwing specification:
-
getState()
- Returns the current state of the state machine.
-
getStateTransitions()
- Gets the states that can be reached from the current state.
-
removeStateChange(String, String)
-
GeneralStateModel
public GeneralStateModel()
- Implements a one state state-machine default constructor.
GeneralStateModel
public void GeneralStateModel(StringTokenizer specification)
- Produces a state machine according to the follwing specification:
- Parameters:
- spec - The format of the input token shall be:
- GSM,[major version],[minor version]
- name
- defaultState
- NumberofStates
- StateName
- NumberOfTransitions
- State1=State2=verb
where:
fireStateChange
public void fireStateChange(ModifiableChangeEvent newState) throws PropertyVetoException
- Change the state from the current state to a new state. If the state
request is not possible then no transition happens. This might happen in a
multi-user game where another user has acted just before this user.
- Parameters:
- newState - is a property change event, caller, "state", string, string.
- Throws: PropertyVetoException
- thrown if a vetoable listener vetoes the
change.
- Overrides:
- fireStateChange in class StateMachine
getState
public String getState()
- Returns the current state of the state machine.
- Overrides:
- getState in class StateMachine
getStateTransitions
public String getStateTransitions()
- Gets the states that can be reached from the current state. An array of
new states is returned.
the format of the response is:
- GSM,[major version],[minor version]
- name
- defaultState
- NumberofStates
- StateName
- NumberOfTransitions
- State1=State2=verb
where:
- the delimeter is "|",
- defaultState = current state,
- number of states = 1, and
- the state is the current state.
- Overrides:
- getStateTransitions in class StateMachine
addStateChange
public void addStateChange(String fromState,
String toState,
String verb)
removeStateChange
public void removeStateChange(String fromState,
String toState)
All Packages Class Hierarchy This Package Previous Next Index
| |
22/11/99
|