package org.java.evolutionary.sequence.func; import ec.*; import org.java.evolutionary.sequence.MotifData; import ec.gp.*; import ec.util.*; /** * This represents two things, and implicit Correlation if there are two close positonals * or explicit correlation between any two things like two positionals not close, one positional * and one compositional, one positional , one disjunctive feature etc etc. * This adds the conjunctive feature in general to features. * @author udaykamath * */ public class And extends GPNode { public String toString() { return " AND "; } public void checkConstraints(final EvolutionState state, final int tree, final GPIndividual typicalIndividual, final Parameter individualBase) { super.checkConstraints(state, tree, typicalIndividual, individualBase); if (children.length != 2) state.output.error("Incorrect number of children for node " + toStringForError() + " at " + individualBase); } public void eval(final EvolutionState state, final int thread, final GPData input, final ADFStack stack, final GPIndividual individual, final Problem problem) { boolean resultLhs, resultRhs; MotifData motifData = ((MotifData) (input)); children[0].eval(state, thread, input, stack, individual, problem); resultLhs = motifData.matches; children[1].eval(state, thread, input, stack, individual, problem); resultRhs = motifData.matches; motifData.matches = (resultLhs && resultRhs); } }