/** * Handle the specified trigger. * @param trigger The trigger that needs to be handled by the state machine. * If this results in an attempt to perform a transition which is not * allowed an {@link IllegalArgumentException} is thrown. * @param context Reference to the context. */ public void handle(@Nullable T trigger, C context) { T ev = trigger; do { if (ev != null) { changeState(ev, context); } ev = currentState.handle(trigger, context); } while (ev != null); }
/** * Handle the specified trigger. * @param trigger The trigger that needs to be handled by the state machine. * If this results in an attempt to perform a transition which is not * allowed an {@link IllegalArgumentException} is thrown. * @param context Reference to the context. */ public void handle(@Nullable T trigger, C context) { T ev = trigger; do { if (ev != null) { changeState(ev, context); } ev = currentState.handle(trigger, context); } while (ev != null); }