package at.oefai.aaa.agent.jam;

import java.util.List;
import java.util.Vector;

/**
 * Represents sequential plan components.
 * @author Marc Huber
 * @author Jaeho Lee
 */
class PlanSequenceConstruct implements PlanConstruct {

    private final List<PlanConstruct> constructs = new Vector<PlanConstruct>(1, 1);

    /**  */
    PlanSequenceConstruct() {
        // package level instantiatable
    }

    /**  */
    PlanSequenceConstruct(PlanConstruct be) {
        insertConstruct(be);
    }

    // Member functions

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

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

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

    /**  */
    public void insertConstruct(PlanConstruct be) {
        if (be != null) {
            this.constructs.add(be);
        }
    }

    /**  */
    PlanConstruct getConstruct(int n) {
        try {
            return this.constructs.get(n);
        } catch (IndexOutOfBoundsException e) {
            return null;
        }
    }

}

