package ru.yandex.webmaster3.core.semantic.semantic_document_parser.microdata.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 current = context;
        while (last.compareTo(current.getStep()) > 0) {
            current = current.nextStep();
        }
        return current;
    }

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

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

}
