@Override
	public FiniteAutomaton execute(FiniteAutomatonTransformerMode mode) {
		FiniteAutomaton fa = getInput();
		
		fa.getStartState();
		
		if (mode == FiniteAutomatonTransformerMode.NONDESTRUCTIVE) {
			fa = fa.clone();
		}
		
		State rejectState = null;
		
		if (alphabet == null) {
			alphabet = FiniteAutomatonUtil.getAlphabet(fa);
		}

		LinkedList<State> statesCopy = new LinkedList<State>();
		statesCopy.addAll(fa.getStates());
		
		for (State s : statesCopy) {
			for (Character sym : alphabet) {
				if (fa.getTransition(s, sym) == null) {
					// missing transition
					
					// create the reject state if not already created
					if (rejectState == null) {
						rejectState = fa.createState();
						for (Character c : alphabet) {
							fa.createTransition(rejectState, rejectState, c);
						}
					}
					
					// create an explicit transition leading to the reject state
					fa.createTransition(s, rejectState, sym);
				}
			}
		}
		
		return fa;
	}