/* * @(#)FSMImpl.java 1.13 03/12/19 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.sun.corba.se.spi.orbutil.fsm ; import java.util.Set ; import java.util.HashSet ; import com.sun.corba.se.spi.orbutil.fsm.Input ; import com.sun.corba.se.spi.orbutil.fsm.StateEngine ; import com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl ; import com.sun.corba.se.impl.orbutil.ORBUtility ; import com.sun.corba.se.spi.orbutil.fsm.FSM ; /** * This is the main class that represents an instance of a state machine * using a state engine. It may be used as a base class, in which case * the guards and actions have access to the derived class. * * @version @(#)FSMImpl.java 1.13 03/12/19 * @author Ken Cavanaugh */ public class FSMImpl implements FSM { private boolean debug ; private State state ; private StateEngineImpl stateEngine ; /** Create an instance of an FSM using the StateEngine * in a particular start state. */ public FSMImpl( StateEngine se, State startState ) { this( se, startState, false ) ; } public FSMImpl( StateEngine se, State startState, boolean debug ) { state = startState ; stateEngine = (StateEngineImpl)se ; this.debug = debug ; } /** Return the current state. */ public State getState() { return state ; } /** Perform the transition for the given input in the current state. This proceeds as follows: *
Let S be the current state of the FSM. * If there are guarded actions for S with input in, evaluate their guards successively until * all have been evaluted, or one returns a non-DISABLED Result. *