Print

Print


As mentioned on another thread, I'm quite the newbie to ECJ, and,
while I'm generally familiar with OO, the intricacies of Java are not
my forte. Having gotten my disclaimers out of the way...

I'm trying to do something similar to this code:
    public void eval(final EvolutionState state,
                     final int thread,
                     final GPData input,
                     final ADFStack stack,
                     final GPIndividual individual,
                     final Problem problem)
        {
        double result;
        DoubleData rd = ((DoubleData)(input));

        children[0].eval(state,thread,input,stack,individual,problem);
        result = rd.x;

        children[1].eval(state,thread,input,stack,individual,problem);
        rd.x = result + rd.x;
        }
    }

This comes from tutorial 4, and it's simple enough, taking two nodes
that return doubles, adding them together, and putting a new double in
the input. In my case, however, I'm actually returning a different
type. I have a BoolData class which encapsulates a Boolean value. How
would you modify this code, for example, to return a BoolData which
indicated whether the result was greater than 100? The input is final,
so I can't replace the reference with a new GPData. What am I missing?