package ac.essex.gp.params;

import ac.essex.gp.nodes.ercs.AutorangeERC;

import java.util.Vector;

/**
 * Autorange ERCs have specific outputs that are determined at runtime. This means that their basic
 * constructor (as called by the usual node params method using class.getInstance) is not sufficient
 * to get the ERC working properly. This object also stores the outputs that the ERC uses so when it
 * is instantiated it may be given all the data it needs.
 *
 * @author Olly Oechsle, University of Essex, Date: 11-Apr-2007
 * @version 1.0
 */
public class AutorangeERCNodeParams extends NodeParams {

    protected int rangeID;
    protected Vector<Double> outputs;
    protected boolean sorted;

    public AutorangeERCNodeParams(String classname, int returntype, int rangeID, int childCount, Vector<Double> outputs, boolean sorted) {
        super(classname, returntype, rangeID, childCount);
        this.rangeID = rangeID;
        this.outputs = outputs;
        this.sorted = sorted;
    }

    /**
     * Overrides the get instance method to ensure that the ERC has all the runtime data it needs to work properly.
     */
    public AutorangeERC getInstance() {
        AutorangeERC newERC = (AutorangeERC) super.getInstance();
        newERC.setRuntimeData(rangeID, outputs, sorted);
        return newERC;
    }

}
