public void addState ( final S newState , final Word < I > accessSequence , final O output ) { final Word < I > prefix = accessSequence . prefix ( accessSequence . length ( ) - 1 ) ; final I sym = accessSequence . lastSymbol ( ) ; final FastMealyState < O > pred = this . observationTree . getSuccessor ( this . observationTree . getInitialState ( ) , prefix ) ; final FastMealyState < O > target ; if ( pred . getTransitionObject ( alphabet . getSymbolIndex ( sym ) ) == null ) { target = this . observationTree . addState ( ) ; this . observationTree . addTransition ( pred , sym , target , output ) ; } else { target = this . observationTree . getSuccessor ( pred , sym ) ; } this . nodeToObservationMap . put ( newState , target ) ; }
Registers a new hypothesis state at the observation tree . It is expected to register states in the order of their discovery meaning whenever a new state is added information about all prefixes of its access sequence are already stored . Therefore providing only the output of the last symbol of its access sequence is sufficient .