// A Mealy Machine must do output on every state transition. We demonstrate // this by inheriting the basic FSM functionality from the FSM class, and // overriding the sendEvent routine to print the new state the machine has entered after // handling the event. This value is still returned to the caller. public class MealyMachine extends FiniteStateMachine { public String sendEvent( String letter ) throws FSMException { String new_state_lbl; new_state_lbl = super.sendEvent(letter); System.out.println( new_state_lbl ); return new_state_lbl; } // end sendEvent };