package ac.essex.ooechs.facedetection.evolved;

import ac.essex.gp.tree.Terminal;
import ac.essex.gp.problems.DataStack;
import ac.essex.gp.params.RangeTypes;
import ac.essex.gp.params.NodeConstraints;
import ac.essex.ooechs.imaging.commons.fast.IntegralImage;

/**
 * <p/>
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version,
 * provided that any use properly credits the author.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details at http://www.gnu.org
 * </p>
 *
 * @author Olly Oechsle, University of Essex, Date: 18-Jun-2008
 * @version 1.0
 */
public abstract class EvolvedFeature extends Terminal {

    public int getDefaultRangeType() {
       return RangeTypes.DONT_CARE;
    }

    public int getReturnType() {
        return NodeConstraints.NUMBER;
    }

    public double execute(DataStack dataStack) {
        dataStack.value = eval(dataStack.getIntegralImage());
        dataStack.usesImaging = true;
        return dataStack.value;
    }

    public abstract double eval(IntegralImage image);

    public String toJava() {
        return this.getClass().getCanonicalName();
    }

    public double subtract(double value1, double value2) {
        return value1 - value2;
    }


}
