private boolean isRecordPositionOk(final long currentRecordIndex) {
        // final PipelineStepTask request = controller.getRequest();
        final long currentStreamIndex = metaHolder.getPartIndex();

        // If we aren't using a step location as a reference point to look
        // before or after then the location will always be ok.
        if (stepLocation == null) {
            return true;
        }

        // If we are moving forward and have got to a stream number that is
        // greater than the one we are looking for then the record position is
        // ok, likewise if we are going backward and the stream number is less
        // than the one requested then the record position is ok.

        // This is written as multiple tests for clarity.
        final StepType stepType = request.getStepType();
        if (StepType.FIRST.equals(stepType) || StepType.LAST.equals(stepType)) {
            return true;
        } else if (StepType.FORWARD.equals(stepType) && currentStreamIndex > stepLocation.getPartIndex()) {
            return true;
        } else if (StepType.BACKWARD.equals(stepType) && currentStreamIndex < stepLocation.getPartIndex()) {
            return true;
        }

        // If the stream number is the same as the one requested then we can
        // test the record number.
        if (currentStreamIndex == stepLocation.getPartIndex()) {
            if (StepType.REFRESH.equals(stepType) && currentRecordIndex == stepLocation.getRecordIndex()) {
                return true;
            } else if (StepType.FORWARD.equals(stepType) && currentRecordIndex > stepLocation.getRecordIndex()) {
                return true;
            } else if (StepType.BACKWARD.equals(stepType) && currentRecordIndex < stepLocation.getRecordIndex()) {
                return true;
            }
        }

        return false;
    }
Used to decide if we have found a record that is in the appropriate
location, e.g. after the last returned record when stepping forward.
stroom-pipeline/src/main/java/stroom/pipeline/stepping/SteppingController.java