1 /* 2 * @(#)State.java 1.7 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package com.sun.corba.se.spi.orbutil.fsm ; 9 10 /** 11 * This interface must be implemented by any class that is used as 12 * a state in a FSM. The FSM only needs the identity of this 13 * object, so all that is really needs is the default equals implementation. 14 * The toString() method should also be overridden to give a concise 15 * description or name of the state. The StateImpl class handles this. 16 * <P> 17 * Pre- and post- actions are taken only on completed transitions between 18 * different states. Assume that the FSM is in state A, and the FSM will 19 * transition to state B under input I with action X. If A != B and X completes 20 * successfully, then after X completes execution, A.postAction is executed, 21 * followed by B.preAction. 22 * 23 * @version @(#)State.java 1.7 03/12/19 24 * @author Ken Cavanaugh 25 */ 26 public interface State 27 { 28 /** Method that defines action that occurs whenever this state is entered. 29 * Any exceptions thrown by this method are ignored. 30 */ 31 void preAction( FSM fsm ) ; 32 33 /** Method that defines action that occurs whenever this state is exited. 34 * Any exceptions thrown by this method are ignored. 35 */ 36 void postAction( FSM fsm ) ; 37 } 38 39 // end of State.java 40