JGAP

examples.gp.tictactoe
Class SingleNodeValidator

java.lang.Object
  extended by examples.gp.tictactoe.SingleNodeValidator
All Implemented Interfaces:
ISingleNodeValidator

public class SingleNodeValidator
extends java.lang.Object
implements ISingleNodeValidator

Valides single nodes during GP program creation to make this process more efficient.

Since:
3.6

Field Summary
 
Fields inherited from interface org.jgap.gp.ISingleNodeValidator
CVS_REVISION
 
Constructor Summary
SingleNodeValidator()
           
 
Method Summary
 boolean isAllowed(int a_chromIndex, ProgramChromosome a_pc, CommandGene[] a_functionSet, CommandGene a_function, java.lang.Class a_returnType, int a_subReturnTyp, int m_index)
          Checks if the given a_function is allowed in the current context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleNodeValidator

public SingleNodeValidator()
Method Detail

isAllowed

public boolean isAllowed(int a_chromIndex,
                         ProgramChromosome a_pc,
                         CommandGene[] a_functionSet,
                         CommandGene a_function,
                         java.lang.Class a_returnType,
                         int a_subReturnTyp,
                         int m_index)
Checks if the given a_function is allowed in the current context.

Specified by:
isAllowed in interface ISingleNodeValidator
Parameters:
a_chromIndex - index of the chromosome within the GP program
a_pc - the instance of the ProgramChromosome
a_functionSet - the current function set within the program chromosome (given as input parameter for convenience, could also be determined via a_pc.m_genes)
a_function - the function that should be added, if allowed
a_returnType - the class the return type is required to have
a_subReturnTyp - the sub return type the return type is required to have
m_index - the index of the up-to-date last command gene in the program chromosome
Returns:
true if a_function's class exists within a_functionSet
Since:
3.6

JGAP