@Override
    protected void parseTransition(StreamTokenizer streamTokenizer) throws FSMParseException, IOException {
        try {
            // check whether we will read a number
            if (streamTokenizer.nextToken() != StreamTokenizer.TT_WORD) {
                throw new FSMParseException(EXPECT_NUMBER, streamTokenizer);
            }

            // read the source state index
            int from = Integer.parseInt(streamTokenizer.sval);

            // check if such a state exists
            if (!states.isEmpty() && !states.containsKey(from)) {
                throw new FSMParseException(String.format(NO_SUCH_STATE, from), streamTokenizer);
            }

            // check whether we will read a number
            if (streamTokenizer.nextToken() != StreamTokenizer.TT_WORD) {
                throw new FSMParseException(EXPECT_NUMBER, streamTokenizer);
            }

            // read the target state
            int to = Integer.parseInt(streamTokenizer.sval);

            // check if such a state exists
            if (!states.isEmpty() && !states.containsKey(to)) {
                throw new FSMParseException(String.format(NO_SUCH_STATE, to), streamTokenizer);
            }

            // check we will read a string
            if (streamTokenizer.nextToken() != '"') {
                throw new FSMParseException(EXPECT_STRING, streamTokenizer);
            }

            // read the input on the transition
            final I input = getInputParser().apply(streamTokenizer.sval);

            // add it to the set of inputs
            getInputs().add(input);

            // add the new transition
            final Integer prev = transitions.put(Pair.of(from, input), to);
            if (prev != null) {
                throw new FSMParseException(String.format(NON_DETERMINISM_DETECTED, prev), streamTokenizer);
            }
        } catch (NumberFormatException nfe) {
            throw new FSMParseException(nfe, streamTokenizer);
        }
    }
@ Override protected void parseTransition ( StreamTokenizer streamTokenizer ) throws FSMParseException , IOException { try { if ( streamTokenizer . nextToken ( ) != StreamTokenizer . TT_WORD ) { throw new FSMParseException ( EXPECT_NUMBER , streamTokenizer ) ; } int from = Integer . parseInt ( streamTokenizer . sval ) ; if ( ! states . isEmpty ( ) && ! states . containsKey ( from ) ) { throw new FSMParseException ( String . format ( NO_SUCH_STATE , from ) , streamTokenizer ) ; } if ( streamTokenizer . nextToken ( ) != StreamTokenizer . TT_WORD ) { throw new FSMParseException ( EXPECT_NUMBER , streamTokenizer ) ; } int to = Integer . parseInt ( streamTokenizer . sval ) ; if ( ! states . isEmpty ( ) && ! states . containsKey ( to ) ) { throw new FSMParseException ( String . format ( NO_SUCH_STATE , to ) , streamTokenizer ) ; } if ( streamTokenizer . nextToken ( ) != '"' ) { throw new FSMParseException ( EXPECT_STRING , streamTokenizer ) ; } final I input = getInputParser ( ) . apply ( streamTokenizer . sval ) ; getInputs ( ) . add ( input ) ; final Integer prev = transitions . put ( Pair . of ( from , input ) , to ) ; if ( prev != null ) { throw new FSMParseException ( String . format ( NON_DETERMINISM_DETECTED , prev ) , streamTokenizer ) ; } } catch ( NumberFormatException nfe ) { throw new FSMParseException ( nfe , streamTokenizer ) ; } }
Parse a transition by searching the current line for the source state, target state and the input.

@throws FSMParseException
when the current line is an illegal transition.
@throws IOException
see {@link StreamTokenizer#nextToken()}.