ArrayList result = new ArrayList();
ArrayList<MovePath> result = new ArrayList<MovePath>();
    public List getNextMoves(boolean backward, boolean forward) {        ArrayList result = new ArrayList();        MoveStep last = getLastStep();        if (isJumping()) {            MovePath left = (MovePath) this.clone();            MovePath right = (MovePath) this.clone();            // From here, we can move F, LF, RF, LLF, RRF, and RRRF.            result.add( ((MovePath) this.clone())                        .addStep(MovePath.STEP_FORWARDS) );            for ( int turn = 0; turn < 2; turn++ ) {                left.addStep(MovePath.STEP_TURN_LEFT);                right.addStep(MovePath.STEP_TURN_RIGHT);                result.add( ((MovePath) left.clone())                            .addStep(MovePath.STEP_FORWARDS) );                result.add( ((MovePath) right.clone())                            .addStep(MovePath.STEP_FORWARDS) );            }            right.addStep(MovePath.STEP_TURN_RIGHT);            result.add( right.addStep(MovePath.STEP_FORWARDS) );            // We've got all our next steps.                        return result;        }        if (getFinalProne() || getFinalHullDown()) {            if (last != null && last.getType() != STEP_TURN_RIGHT) {                result.add(((MovePath) this.clone()).addStep(MovePath.STEP_TURN_LEFT));            }            if (last != null && last.getType() != STEP_TURN_LEFT) {                result.add(((MovePath) this.clone()).addStep(MovePath.STEP_TURN_RIGHT));            }            result.add(((MovePath) this.clone()).addStep(MovePath.STEP_GET_UP));            return result;        }        if (canShift()) {            if (forward && (!backward || (last == null || last.getType() != MovePath.STEP_LATERAL_LEFT))) {                result.add(((MovePath) this.clone()).addStep(STEP_LATERAL_RIGHT));            }            if (forward && (!backward || (last == null || last.getType() != MovePath.STEP_LATERAL_RIGHT))) {                result.add(((MovePath) this.clone()).addStep(MovePath.STEP_LATERAL_LEFT));            }            if (backward && (!forward || (last == null || last.getType() != MovePath.STEP_LATERAL_LEFT_BACKWARDS))) {                result.add(((MovePath) this.clone()).addStep(MovePath.STEP_LATERAL_RIGHT_BACKWARDS));            }            if (backward && (!forward || (last == null || last.getType() != MovePath.STEP_LATERAL_RIGHT_BACKWARDS))) {                result.add(((MovePath) this.clone()).addStep(MovePath.STEP_LATERAL_LEFT_BACKWARDS));            }        }        if (forward && (!backward || (last == null || last.getType() != MovePath.STEP_BACKWARDS))) {            result.add(((MovePath) this.clone()).addStep(MovePath.STEP_FORWARDS));        }        if (last == null || last.getType() != MovePath.STEP_TURN_LEFT) {            result.add(((MovePath) this.clone()).addStep(MovePath.STEP_TURN_RIGHT));        }        if (last == null || last.getType() != MovePath.STEP_TURN_RIGHT) {            result.add(((MovePath) this.clone()).addStep(MovePath.STEP_TURN_LEFT));        }        if (backward && (!forward || (last == null || last.getType() != MovePath.STEP_FORWARDS))) {            result.add(((MovePath) this.clone()).addStep(MovePath.STEP_BACKWARDS));        }        return result;    }