question: @ SuppressWarnings ( "unused" ) private void transformLateralShift ( ) { if ( steps . size ( ) < 3 ) { return ; } final int index = steps . size ( ) - 3 ; final MoveStep step1 = getStep ( index ) ; final MoveStep step2 = getStep ( index + 1 ) ; final MoveStep step3 = getStep ( index + 2 ) ; if ( step1 . oppositeTurn ( step3 ) && ( ( step2 . getType ( ) == MovePath . MoveStepType . BACKWARDS ) || ( step2 . getType ( ) == MovePath . MoveStepType . FORWARDS ) ) ) { final MoveStepType stepType = step1 . getType ( ) ; final MoveStepType direction = step2 . getType ( ) ; steps . removeElementAt ( index ) ; steps . removeElementAt ( index ) ; steps . removeElementAt ( index ) ; final MoveStep shift = new MoveStep ( this , lateralShiftForTurn ( stepType , direction ) ) ; addStep ( shift ) ; } }
target:  Changes turn-forwards-opposite-turn sequences into quad lateral shifts. <p/> Finds the sequence of three steps that can be transformed, then removes all three and replaces them with the lateral shift step.