public void encode ( int symbol , Context cm ) throws IOException { int rangeLps = MQConst . pLps [ cm . getState ( ) ] ; if ( symbol == cm . getMps ( ) ) { range -= rangeLps ; offset += rangeLps ; if ( range < 0x8000 ) { while ( range < 0x8000 ) renormalize ( ) ; cm . setState ( MQConst . transitMPS [ cm . getState ( ) ] ) ; } } else { range = rangeLps ; while ( range < 0x8000 ) renormalize ( ) ; if ( MQConst . mpsSwitch [ cm . getState ( ) ] != 0 ) cm . setMps ( 1 - cm . getMps ( ) ) ; cm . setState ( MQConst . transitLPS [ cm . getState ( ) ] ) ; } }
Encodes one symbol either 0 or 1