src/main/java/de/dfki/lt/loot/fsa/FiniteAutomaton.java
public SubAutomaton alternative(SubAutomaton lhs, SubAutomaton rhs) {
    // the result automaton will be created by modifying the rhs automaton

    // created new initial and final state
    int newInitialState = this.newVertex();
    int newFinalState = this.newVertex();

    // link states according to slides
    this.newEdge(EPSILON, newInitialState, lhs.getInitialState());
    this.newEdge(EPSILON, newInitialState, rhs.getInitialState());
    this.newEdge(EPSILON, lhs.getFinalState(), newFinalState);
    this.newEdge(EPSILON, rhs.getFinalState(), newFinalState);

    // define new initial and final state in the result automaton
    lhs.setInitialState(newInitialState);
    lhs.setFinalState(newFinalState);

    rhs.setInitialState(-1);
    rhs.setFinalState(-1);
    return lhs;
  }
/**
   * This creates an automaton that matches the language of this automaton or
   * the language of the given rhs automaton.
   *
   * The current automaton is modified so that it contains the result automaton
   * after calling this method. The rhs will be modified and should not be used
   * afterwards.
   *
   * @param this a <code>FiniteAutomaton</code> with the left hand side of the
   * alternative
   * @param rhs a <code>FiniteAutomaton</code> with the right hand side of the
   * alternative
   */
This creates an automaton that matches the language of this automaton or
the language of the given rhs automaton.

The current automaton is modified so that it contains the result automaton
after calling this method. The rhs will be modified and should not be used
afterwards.

@param this a FiniteAutomaton with the left hand side of the
alternative
@param rhs a FiniteAutomaton with the right hand side of the
alternative
This creates an automaton that matches the language of this automaton or the language of the given rhs automaton . The current automaton is modified so that it contains the result automaton after calling this method . The rhs will be modified and should not be used afterwards . @param this a FiniteAutomaton with the left hand side of the alternative @param rhs a FiniteAutomaton with the right hand side of the alternative
public SubAutomaton alternative(SubAutomaton lhs, SubAutomaton rhs) {
    int newInitialState = this.newVertex();
    int newFinalState = this.newVertex();
    this.newEdge(EPSILON, newInitialState, lhs.getInitialState());
    this.newEdge(EPSILON, newInitialState, rhs.getInitialState());
    this.newEdge(EPSILON, lhs.getFinalState(), newFinalState);
    this.newEdge(EPSILON, rhs.getFinalState(), newFinalState);
    lhs.setInitialState(newInitialState);
    lhs.setFinalState(newFinalState);
    rhs.setInitialState(-1);
    rhs.setFinalState(-1);
    return lhs;
  }
public SubAutomaton alternative ( SubAutomaton lhs , SubAutomaton rhs ) { int newInitialState = this . newVertex ( ) ; int newFinalState = this . newVertex ( ) ; this . newEdge ( EPSILON , newInitialState , lhs . getInitialState ( ) ) ; this . newEdge ( EPSILON , newInitialState , rhs . getInitialState ( ) ) ; this . newEdge ( EPSILON , lhs . getFinalState ( ) , newFinalState ) ; this . newEdge ( EPSILON , rhs . getFinalState ( ) , newFinalState ) ; lhs . setInitialState ( newInitialState ) ; lhs . setFinalState ( newFinalState ) ; rhs . setInitialState ( - 1 ) ; rhs . setFinalState ( - 1 ) ; return lhs ; }
This creates an automaton that matches the language of this automaton or
 the language of the given rhs automaton.
This creates an automaton that matches the language of this automaton or the language of the given rhs automaton .
// the result automaton will be created by modifying the rhs automaton // created new initial and final state // link states according to slides // define new initial and final state in the result automaton