package at.oefai.aaa.agent.jam;

import java.util.List;

/**
 * Represents one case of an iterative construct within plans.
 * @author Marc Huber
 * @author Jaeho Lee
 */
class PlanDoConstruct implements PlanConstruct {

    private Action test; // The predicate for the loop
    private PlanSequenceConstruct constructs; // The constructs in the WHILE loop

    /**  */
    PlanDoConstruct(final Action a, final PlanConstruct be) {
        this.test = a;
        this.constructs = new PlanSequenceConstruct(be);
    }


    // Member functions

    public Action getTest() { return this.test; }

    public void setTest(final Action a) { this.test = a; }

    PlanSequenceConstruct getSequence() { return this.constructs; }

    /**  */
    public PlanRuntimeState newRuntimeState() {
        return new PlanRuntimeDoState(this);
    }

    /**  */
    public void insertConstruct(final PlanConstruct be) {
        this.constructs.insertConstruct(be);
    }

    /**  */
    public int getNumConstructs() {
        return this.constructs.getNumConstructs();
    }

    /**  */
    public List getConstructs() {
        return this.constructs.getConstructs();
    }

    /**  */
    PlanConstruct getConstruct(final int n) {
        return this.constructs.getConstruct(n);
    }

}

