private void breakTies ( List < InvPair > v ) { Iterator < InvPair > it = v . iterator ( ) ; InvPair curr ; InvPair last = null ; int tie = 0 ; boolean found = false ; for ( int x = 0 ; it . hasNext ( ) ; x ++ ) { curr = it . next ( ) ; curr . setCurr ( curr . getCurr ( ) * 2 ) ; curr . setPrime ( ) ; if ( x != 0 && ! found && curr . getCurr ( ) == last . getCurr ( ) ) { tie = x - 1 ; found = true ; } last = curr ; } curr = ( InvPair ) v . get ( tie ) ; curr . setCurr ( curr . getCurr ( ) - 1 ) ; curr . setPrime ( ) ; }
Break ties . Corresponds to step 7