package ru.yandex.webmaster3.core.semantic.semantic_document_parser.ogp.transformer;

/**
 * Created by IntelliJ IDEA.
 * User: rasifiel
 * Date: 7/15/11
 * Time: 10:24 AM
 * To change this template use File | Settings | File Templates.
 */
public class TransformStrategy {

    public TransformStrategy() {
    }

    public Context processNextStep(final Context context) {
        return context.nextStep();
    }

    /**
     * дойти до состояния <code>last</code>
     *
     * @param last
     * @param context
     * @return
     */
    public Context processTillStep(final TransformationStep last, final Context context) {
        Context currentStep = context;
        while (last.compareTo(currentStep.getStep()) > 0) {
            currentStep = currentStep.nextStep();
        }
        return currentStep;
    }

    /**
     * дойти до конечного состояния
     *
     * @param context
     * @return
     */

    public Context processTillDone(final Context context) {
        return processTillStep(TransformationStep.FINAL, context);
    }

}
