State newState = newAutomaton.addState();
for (State state : newAutomaton.allStates()) {
if (newAutomaton.isFinal(state)) {
newAutomaton.addTransition(state, newState, new EpsilonTransitionLabel());
newAutomaton.unmarkAsFinalState(state);
}
}
newAutomaton.insert(newState, subautomaton);
}
State newState = newAutomaton.addState();