public void copy(Automaton other){
  int stateOffset=getNumStates();
  states=ArrayUtil.grow(states,nextState + other.nextState);
  System.arraycopy(other.states,0,states,nextState,other.nextState);
  for (int i=0; i < other.nextState; i+=2) {
    if (states[nextState + i] != -1) {
      states[nextState + i]+=nextTransition;
    }
  }
  nextState+=other.nextState;
  int otherNumStates=other.getNumStates();
  BitSet otherAcceptStates=other.getAcceptStates();
  int state=0;
  while (state < otherNumStates && (state=otherAcceptStates.nextSetBit(state)) != -1) {
    setAccept(stateOffset + state,true);
    state++;
  }
  transitions=ArrayUtil.grow(transitions,nextTransition + other.nextTransition);
  System.arraycopy(other.transitions,0,transitions,nextTransition,other.nextTransition);
  for (int i=0; i < other.nextTransition; i+=3) {
    transitions[nextTransition + i]+=stateOffset;
  }
  nextTransition+=other.nextTransition;
  if (other.deterministic == false) {
    deterministic=false;
  }
}

public void copy ( Automaton other ) { int stateOffset = getNumStates ( ) ; states = ArrayUtil . grow ( states , nextState + other . nextState ) ; System . arraycopy ( other . states , 0 , states , nextState , other . nextState ) ; for ( int i = 0 ; i < other . nextState ; i += 2 ) { if ( states [ nextState + i ] != - 1 ) { states [ nextState + i ] += nextTransition ; } } nextState += other . nextState ; int otherNumStates = other . getNumStates ( ) ; BitSet otherAcceptStates = other . getAcceptStates ( ) ; int state = 0 ; while ( state < otherNumStates && ( state = otherAcceptStates . nextSetBit ( state ) ) != - 1 ) { setAccept ( stateOffset + state , true ) ; state ++ ; } transitions = ArrayUtil . grow ( transitions , nextTransition + other . nextTransition ) ; System . arraycopy ( other . transitions , 0 , transitions , nextTransition , other . nextTransition ) ; for ( int i = 0 ; i < other . nextTransition ; i += 3 ) { transitions [ nextTransition + i ] += stateOffset ; } nextTransition += other . nextTransition ; if ( other . deterministic == false ) { deterministic = false ; } }
copies over all states / transitions from other . the states numbers are sequentially assigned ( appended ) .
