public bool consumeEvent(IEvent e) { if (currentState.getTransitionableState().Keys.Contains(e.getEventName())) { currentState = currentState.getTransitionableState()[e.getEventName()]; currentState.run(e); } else { LOG.Error("Unexcepted event occur: " + e.getEventName()); } return true; }
public bool consumeEvent(IEvent e) { if (currentState.getTransitionableState().Keys.Contains(e.getEventName())) { LOG.Info("Consume event '" + e.getEventName() + "'"); // Get next state currentState = currentState.getTransitionableState()[e.getEventName()]; currentState.run(e); return true; } else { LOG.Error("Unexpected event occur: " + e.getEventName()); throw new EventNotAcceptableException(e.getEventName() + " not acceptable in '" + currentState.getStateName() + "'"); } }