Documentation of 'org.jgap.gp.terminal.Variable' Java class
Variable
org.jgap.gp.terminal

Class Variable

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


    public class Variable
    extends CommandGene
    A terminal represented by a variable (x, y, z...). A variable has one single value with can be influenced from outside.
    Since:
    3.0
    See Also:
    Serialized Form
    • Field Detail

      • vars

        public static java.util.Hashtable vars
    • 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()
        Attention: It is important to return m_name here (see GPGenotype.putVariable).
        Overrides:
        getName in class CommandGene
        Returns:
        textual name of this command
        Since:
        3.2
      • 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
      • execute_boolean

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

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

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

        public float execute_float(ProgramChromosome c,
                                   int n,
                                   java.lang.Object[] args)
        Description copied from class: CommandGene
        Executes this node as a float. Override to implement.
        Overrides:
        execute_float in class CommandGene
        Parameters:
        c - ignored here
        n - ignored here
        args - ignored here
        Returns:
        nothing but exception
      • 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
      • 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
      • getVariable

        public static Variable getVariable(java.lang.String name)
        Gets the one instance of a named variable.
        Parameters:
        name - the name of the variable to get
        Returns:
        the named variable, or null if that name wasn't found.
        Since:
        3.0
      • create

        public static Variable create(GPConfiguration a_conf,
                                      java.lang.String a_name,
                                      java.lang.Class a_type)
                               throws InvalidConfigurationException
        Creates an instance of a Variable. If a Variable of that name already exists, that is returned. Otherwise a new instance is created, its value is initialized to null, and it is placed into the static hashtable for later retrieval by name via getVariable.
        Parameters:
        a_conf - the configuration to use
        a_name - the name of the Variable to create
        a_type - the type of the Variable to create
        Returns:
        the variable object created
        Throws:
        InvalidConfigurationException
        Since:
        3.0
      • set

        public void set(java.lang.Object a_value)
        Sets the value of this named variable.
        Parameters:
        a_value - the value to set this variable with
        Since:
        3.0
      • getValue

        public java.lang.Object getValue()

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.