public FiniteStateAutomaton convertToDFA(Automaton automaton) {
		/** check if actually nfa. */
		AutomatonChecker ac = new AutomatonChecker();
		if (!ac.isNFA(automaton)) {
			return (FiniteStateAutomaton) automaton.clone();
		}
		/** remove multiple character labels. */
		if (FSALabelHandler.hasMultipleCharacterLabels(automaton)) {
			FSALabelHandler.removeMultipleCharacterLabelsFromAutomaton(automaton);
		}
		/** create new finite state automaton. */
		FiniteStateAutomaton dfa = new FiniteStateAutomaton();
		State initialState = createInitialState(automaton, dfa);
		/**
		 * get initial state and add to list of states that need to be expanded.
		 */
		ArrayList list = new ArrayList();
		list.add(initialState);
		/** while still more states to be expanded. */
		while (!list.isEmpty()) {
			ArrayList statesToExpand = new ArrayList();
			Iterator it = list.iterator();
			while (it.hasNext()) {
				State state = (State) it.next();
				/** expand state. */
				statesToExpand.addAll(expandState(state, automaton, dfa));
				it.remove();
			}
			list.addAll(statesToExpand);
		}

		return dfa;
	}