private void updateOptStateAndReps ( ) { int optPrev = opts [ optCur ] . optPrev ; assert optPrev < optCur ; if ( opts [ optCur ] . prev1IsLiteral ) { -- optPrev ; if ( opts [ optCur ] . hasPrev2 ) { opts [ optCur ] . state . set ( opts [ opts [ optCur ] . optPrev2 ] . state ) ; if ( opts [ optCur ] . backPrev2 < REPS ) opts [ optCur ] . state . updateLongRep ( ) ; else opts [ optCur ] . state . updateMatch ( ) ; } else { opts [ optCur ] . state . set ( opts [ optPrev ] . state ) ; } opts [ optCur ] . state . updateLiteral ( ) ; } else { opts [ optCur ] . state . set ( opts [ optPrev ] . state ) ; } if ( optPrev == optCur - 1 ) { // Must be either a short rep or a literal. assert opts [ optCur ] . backPrev == 0 || opts [ optCur ] . backPrev == - 1 ; if ( opts [ optCur ] . backPrev == 0 ) opts [ optCur ] . state . updateShortRep ( ) ; else opts [ optCur ] . state . updateLiteral ( ) ; System . arraycopy ( opts [ optPrev ] . reps , 0 , opts [ optCur ] . reps , 0 , REPS ) ; } else { int back ; if ( opts [ optCur ] . prev1IsLiteral && opts [ optCur ] . hasPrev2 ) { optPrev = opts [ optCur ] . optPrev2 ; back = opts [ optCur ] . backPrev2 ; opts [ optCur ] . state . updateLongRep ( ) ; } else { back = opts [ optCur ] . backPrev ; if ( back < REPS ) opts [ optCur ] . state . updateLongRep ( ) ; else opts [ optCur ] . state . updateMatch ( ) ; } if ( back < REPS ) { opts [ optCur ] . reps [ 0 ] = opts [ optPrev ] . reps [ back ] ; int rep ; for ( rep = 1 ; rep <= back ; ++ rep ) opts [ optCur ] . reps [ rep ] = opts [ optPrev ] . reps [ rep - 1 ] ; for ( ; rep < REPS ; ++ rep ) opts [ optCur ] . reps [ rep ] = opts [ optPrev ] . reps [ rep ] ; } else { opts [ optCur ] . reps [ 0 ] = back - REPS ; System . arraycopy ( opts [ optPrev ] . reps , 0 , opts [ optCur ] . reps , 1 , REPS - 1 ) ; } } }
Updates the state and reps for the current byte in the opts array .