package at.oefai.aaa.agent.jam;

import java.util.List;

/**
 * Represents a special-case of branching plan (single branch) components.
 * @author Marc Huber
 * @author Jaeho Lee
 */
class PlanWhenConstruct implements PlanConstruct {

    private Action test; // The predicate
    private PlanSequenceConstruct constructs; // The When body


    /**  */
    PlanWhenConstruct(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 int getNumConstructs() {
        return this.constructs.getNumConstructs();
    }

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

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

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

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

}


