Documentation of 'org.jgap.symbolic.ForLoopD' Java class
ForLoopD
org.jgap.symbolic

Class ForLoopD

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, ICloneable


    public class ForLoopD
    extends CommandGene
    implements ICloneable
    The for-loop. You can preset the start index and the end index. If the latter is not given, it is dynamically computed from a child. hakank: I adapted it for doubleClass
    See Also:
    Serialized Form
    • Constructor Detail

      • ForLoopD

        public ForLoopD(GPConfiguration a_conf,
                        java.lang.Class a_typeVar,
                        int a_startIndex,
                        int a_maxLoop)
                 throws InvalidConfigurationException
        Constructor allowing to preset the starting index of the loop.
        Parameters:
        a_conf - the configuration to use
        a_typeVar - Class of the loop counter terminakl (e.g. IntegerClass)
        a_startIndex - index to start the loop with (normally 0)
        a_maxLoop - the maximum number of loops to perform
        Throws:
        InvalidConfigurationException
        Since:
        3.0
      • ForLoopD

        public ForLoopD(GPConfiguration a_conf,
                        java.lang.Class a_typeVar,
                        int a_startIndex,
                        int a_endIndex,
                        int a_increment,
                        java.lang.String a_varName)
                 throws InvalidConfigurationException
        Constructor allowing to preset the starting and the ending index of the loop.
        Parameters:
        a_conf - the configuration to use
        a_typeVar - Class of the loop counter terminal (e.g. IntegerClass)
        a_startIndex - index to start the loop with
        a_endIndex - index to end the loop with
        a_increment - the maximum number of loops to perform
        a_varName - informal textual name of the loop counter variable
        Throws:
        InvalidConfigurationException
        Since:
        3.2
    • Method Detail

      • toString

        public java.lang.String toString()
        Specified by:
        toString in class CommandGene
        Returns:
        the string representation of the command. Especially usefull to output a resulting formula in human-readable form.
      • getName

        public java.lang.String getName()
        Overrides:
        getName in class CommandGene
        Returns:
        textual name of this command
        Since:
        3.2
      • execute_object

        public java.lang.Object execute_object(ProgramChromosome c,
                                               int n,
                                               java.lang.Object[] args)
        Description copied from class: CommandGene
        Executes this node as an object. Override to implement.
        Overrides:
        execute_object in class CommandGene
        Parameters:
        c - ignored here
        n - ignored here
        args - ignored here
        Returns:
        nothing but exception
      • execute_void

        public void execute_void(ProgramChromosome c,
                                 int n,
                                 java.lang.Object[] args)
        Description copied from class: CommandGene
        Executes this node, returning nothing. Override to implement.
        Overrides:
        execute_void in class CommandGene
        Parameters:
        c - ignored here
        n - ignored here
        args - ignored here
      • execute_double

        public double execute_double(ProgramChromosome c,
                                     int n,
                                     java.lang.Object[] args)
        Description copied from class: CommandGene
        Executes this node as a double. Override to implement.
        Overrides:
        execute_double in class CommandGene
        Parameters:
        c - ignored here
        n - ignored here
        args - ignored here
        Returns:
        nothing but exception
      • isValid

        public boolean isValid(ProgramChromosome a_program)
        Description copied from class: CommandGene
        Subclasses capable of validating programs should overwrite this method. See class Push as a sample.
        Overrides:
        isValid in class CommandGene
        Parameters:
        a_program - the ProgramChromosome to validate
        Returns:
        true: a_program is (superficially) valid with the current Command
      • getChildType

        public java.lang.Class getChildType(IGPProgram a_ind,
                                            int a_chromNum)
        Description copied from class: CommandGene
        Gets the type of node allowed from the given child number. Should be overridden in subclasses.
        Overrides:
        getChildType in class CommandGene
        Parameters:
        a_ind - the individual the child belongs to
        a_chromNum - the chromosome number
        Returns:
        the type of node allowed for that child, or null of no child exists
      • getVarName

        public java.lang.String getVarName()
        Returns:
        symbolic name of the variable name used in the for header.
      • compareTo

        public int compareTo(java.lang.Object a_other)
        The compareTo-method.
        Specified by:
        compareTo in interface java.lang.Comparable
        Overrides:
        compareTo in class CommandGene
        Parameters:
        a_other - the other object to compare
        Returns:
        -1, 0, 1
        Since:
        3.0
      • equals

        public boolean equals(java.lang.Object a_other)
        The equals-method.
        Overrides:
        equals in class CommandGene
        Parameters:
        a_other - the other object to compare
        Returns:
        true if the objects are seen as equal
      • getCounterMemoryName

        public java.lang.String getCounterMemoryName()
        Returns:
        name of the memory cell where the current value of the loop variable is stored
      • clone

        public java.lang.Object clone()
        Clones the object. Simple and straight forward implementation here.
        Specified by:
        clone in interface ICloneable
        Overrides:
        clone in class java.lang.Object
        Returns:
        cloned instance of this object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.