public StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT> addTransition(
      STATE preState, STATE postState, Set<EVENTTYPE> eventTypes,
      SingleArcTransition<OPERAND, EVENT> hook) {
    StateMachineFactory<OPERAND, STATE, EVENTTYPE, EVENT> factory = null;
    for (EVENTTYPE event : eventTypes) {
      if (factory == null) {
        factory = addTransition(preState, postState, event, hook);
      } else {
        factory = factory.addTransition(preState, postState, event, hook);
      }
    }
    return factory;
  }
@return a NEW StateMachineFactory just like {@code this} with the current
         transition added as a new legal transition

        Note that the returned StateMachineFactory is a distinct
        object.

        This method is part of the API.

@param preState pre-transition state
@param postState post-transition state
@param eventTypes List of stimuli for the transitions
@param hook transition hook
ambari-server/src/main/java/org/apache/ambari/server/state/fsm/StateMachineFactory.java