class Kleene::MultiMatchDFA

def create_composite_nfa(nfas)

create a composite NFA as the union of all the NFAs with epsilon transitions from every NFA state back to the union NFA's start state
def create_composite_nfa(nfas)
  nfa = union!(nfas)
  # add epsilon transitions from all the states except the start state back to the start state
  nfa.states.each do |state|
    if state != nfa.start_state
      nfa.add_transition(NFATransition::Epsilon, state, nfa.start_state)
    end
  end
  nfa.update_final_states
  nfa
end