private void tidyTrail ( ) { int i ; // Check that there is a current choice point to tidy down to, otherwise tidy down to the root of the trail. if ( bp == 0 ) { i = TRAIL_BASE ; } else { i = data . get ( bp + data . get ( bp ) + 5 ) ; } while ( i < trp ) { int addr = data . get ( i ) ; if ( ( addr < hbp ) || ( ( hp < addr ) && ( addr < bp ) ) ) { i ++ ; } else { data . put ( i , data . get ( trp - 1 ) ) ; trp -- ; } } }
Tidies trail when a choice point is being discarded and a previous choice point it being made the current one .