private static Set findFinal(Automaton a) {
		Set finalized = new HashSet();
		finalized.addAll(Arrays.asList(a.getFinalStates()));
		boolean added = finalized.size() != 0;
		Transition[] t = a.getTransitions();
		while (added) {
			added = false;
			for (int i = 0; i < t.length; i++)
				if (finalized.contains(t[i].getToState()))
					added = added || finalized.add(t[i].getFromState());
		}
		return finalized;
	}