private void ensureCapacity(int newNumStates){
  int oldLength=epsilon.length;
  if (newNumStates < oldLength)   return;
  int newStatesLength=Math.max(oldLength * 2,newNumStates);
  boolean[] newFinal=new boolean[newStatesLength];
  boolean[] newIsPush=new boolean[newStatesLength];
  Action[] newAction=new Action[newStatesLength];
  StateSet[][] newTable=new StateSet[newStatesLength][numInput];
  StateSet[] newEpsilon=new StateSet[newStatesLength];
  System.arraycopy(isFinal,0,newFinal,0,numStates);
  System.arraycopy(action,0,newAction,0,numStates);
  System.arraycopy(epsilon,0,newEpsilon,0,numStates);
  System.arraycopy(table,0,newTable,0,numStates);
  isFinal=newFinal;
  action=newAction;
  epsilon=newEpsilon;
  table=newTable;
}

private void ensureCapacity ( int newNumStates ) { int oldLength = epsilon . length ; if ( newNumStates < oldLength ) return ; int newStatesLength = Math . max ( oldLength * 2 , newNumStates ) ; boolean [ ] newFinal = new boolean [ newStatesLength ] ; boolean [ ] newIsPush = new boolean [ newStatesLength ] ; Action [ ] newAction = new Action [ newStatesLength ] ; StateSet [ ] [ ] newTable = new StateSet [ newStatesLength ] [ numInput ] ; StateSet [ ] newEpsilon = new StateSet [ newStatesLength ] ; System . arraycopy ( isFinal , 0 , newFinal , 0 , numStates ) ; System . arraycopy ( action , 0 , newAction , 0 , numStates ) ; System . arraycopy ( epsilon , 0 , newEpsilon , 0 , numStates ) ; System . arraycopy ( table , 0 , newTable , 0 , numStates ) ; isFinal = newFinal ; action = newAction ; epsilon = newEpsilon ; table = newTable ; }
make sure the nfa can contain at least newnumstates states .
