package ac.essex.gp.nodes.ercs;

import ac.essex.gp.params.NodeParams;
import ac.essex.gp.params.RangeTypes;

/**
 * For If statement compatibility only. Not really very useful.
 *
 * @author Olly Oechsle, University of Essex, Date: 17-Jan-2007
 * @version 1.0
 */
public class BoolERC extends BasicERC {

    public void jitter() {
        // do nothing - boolean's can't be jittered
    }

    public void setValue(double value) {
        this.value = value == 0? 0 : 1;
    }

    public double setValue() {
        return Math.random() > 0.5? 1 : 0;
    }

    public int getReturnType() {
        return NodeParams.BOOLEAN;
    }

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

    public String toJava() {
        return value == 1? "true" : "false";
    }

}
