/home/ooechs/Ecj2Java/src/ac/essex/ooechs/ecj/ecj2java/example/data/DoubleData.java

package ac.essex.ooechs.ecj.ecj2java.example.data; 
 
import ec.gp.GPData; 
 
/** 
 * 
 * Allows a double data type to be passed up and down the tree. 
 * 
 * <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: 06-Dec-2006 
 * @version 1.0 
 */ 
public class DoubleData extends GPData { 
 
    public double x;    // store a double value 
 
    // copy my stuff to another DoubleData 
    public GPData copyTo(final GPData gpd) { 
        ((DoubleData) gpd).x = x; 
        return gpd; 
    } 
 
    /** 
     * Allows the DoubleData to handle boolean data 
     * by assuming a value of either 0 or 1. 
     */ 
    public boolean getBoolean() { 
        return x == 1; 
    } 
 
    /** 
     * Sets the double data as a boolean value:<br /> 
     * If the boolean is true, the value is set to 1<br /> 
     * If the boolean is false, the value is set to 0<br /> 
     */ 
    public void setBoolean(boolean b) { 
        this.x = b ? 1 : 0; 
    } 
 
}