Extension SDK

oracle.ide.panels
Class FSMBuilder

java.lang.Object
  extended byoracle.ide.panels.FSMBuilder

public class FSMBuilder
extends java.lang.Object

This class provides a standard way to build a finite state machine representation that is operated by a FSM.


Constructor Summary
FSMBuilder()
          Initializes the FSMBuilder.
FSMBuilder(Step[] fsmSteps)
           
FSMBuilder(java.lang.String[] fsmStates)
           
FSMBuilder(java.lang.String[][] fsmSpec)
          This constructor accepts a two-dimensional String array whose contents constitute an FSM specification.
 
Method Summary
 void addStateTrans(java.lang.Object trans, java.lang.Object targetStateID)
          Adds the specified transition to the FSM state.
 FSM getFSM()
          Returns an FSM for the specification that has been built up using this FSMBuilder.
 FSM getFSM(java.lang.Object haltingTransition)
          Same as the method with no arguments, except that the argument here specifies the halting transition associated with the FSM.
 void newState(java.lang.Object stateID, boolean isFinalState)
          Tells the builder to create a new state in the FSM.
 void setFSMState(Step fsmStep)
          The FSMBuilder must have its current state set before calling this method or else a NullPointerException is thrown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSMBuilder

public FSMBuilder()
Initializes the FSMBuilder. The newState() method should be called immediately after creating a new FSMBuilder; generally, you would want to create the START_STATE first.


FSMBuilder

public FSMBuilder(java.lang.String[] fsmStates)

FSMBuilder

public FSMBuilder(Step[] fsmSteps)

FSMBuilder

public FSMBuilder(java.lang.String[][] fsmSpec)
This constructor accepts a two-dimensional String array whose contents constitute an FSM specification. The String[][] argument expresses the FSM as an array of states; thus each state is just a String[]. Within each state, you have the following items, in this order:
  1. Name of the state.
  2. Name of the FSMState class associated with this state.
  3. Whether the state is a final state. The string "true" (using any combination of upper and lower case) means it is a final state. Any other string means it's not a final state.
  4. Any number of pairs of strings where the first string is the transition and the second string is the target state name.

Method Detail

getFSM

public FSM getFSM()
           throws FSMInvalidException
Returns an FSM for the specification that has been built up using this FSMBuilder. If the FSM specification is invalid, an FSMInvalidException is thrown.

Throws:
FSMInvalidException

getFSM

public FSM getFSM(java.lang.Object haltingTransition)
           throws FSMInvalidException
Same as the method with no arguments, except that the argument here specifies the halting transition associated with the FSM.

Throws:
FSMInvalidException

setFSMState

public void setFSMState(Step fsmStep)
The FSMBuilder must have its current state set before calling this method or else a NullPointerException is thrown. This method will set the action that is to be taken when the FSM enters the current state.


addStateTrans

public void addStateTrans(java.lang.Object trans,
                          java.lang.Object targetStateID)
Adds the specified transition to the FSM state. Thus, whenever trans occurs in this FSM state, the FSM will move to the state identified by targetStateID.


newState

public void newState(java.lang.Object stateID,
                     boolean isFinalState)
Tells the builder to create a new state in the FSM. The state is created; its transition Map is created; and the state is added to the FSM. The FSMBuilder will then apply subsequent changes (invoked through setStateAction() and addStateTrans()) to this newly created state.

If the specified stateID already exists in the FSM, then the FSMBuilder sets its own internal state so that subsequent FSM changes are made to the already existing FSM state.


Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.