# File lib/CodingStateMachine.rb, line 44 def next_state(c) # for each byte we get its class # if it is first byte, we also get byte length byteCls = @_mModel['classTable'][c] if @_mCurrentState == :Start @_mCurrentBytePos = 0 @_mCurrentCharLen = @_mModel['charLenTable'][byteCls] end # from byte's class and stateTable, we get its next state stateValue = {:Start => 0, :Error => 1, :ItsMe => 2} unless stateValue[@_mCurrentState] v = @_mCurrentState else v = stateValue[@_mCurrentState] end @_mCurrentState = @_mModel['stateTable'][v * @_mModel['classFactor'] + byteCls] @_mCurrentBytePos += 1 return @_mCurrentState end