Class gpjpp.GPGeneReference
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpjpp.GPGeneReference

java.lang.Object
   |
   +----gpjpp.GPGeneReference

public class GPGeneReference
extends Object
Encapsulates the input and output parameters to the tree search routines used for crossover and mutation. This class is needed because Java cannot compute the address of a variable. The functions in gpc++ that take the address of a pointer in order to update a tree cannot be directly ported to Java. Instead, gpjpp maintains the container and index within the container of each gene being searched. This effectively provides the address of the gene itself and makes it possible to replace the gene with a gene branch from another source.

This class is for internal use.

Version:
1.0

Variable Index

 o container
The container that holds a particular gene.
 o count
Used by a search function to count the number of genes to pass or the number that were passed.
 o index
The index of a particular gene within its container.

Constructor Index

 o GPGeneReference()
Instantiates a gene reference for later use.
 o GPGeneReference(GPContainer, int)
Instantiates a gene reference with a known container and index.
 o GPGeneReference(GPGeneReference)
Clones another gene reference.

Method Index

 o assignContainer(GPContainer, int)
Assigns a particular container and index to this gene reference.
 o assignRef(GPGeneReference)
Assigns another gene reference to this one.
 o getGene()
Returns the gene referenced by this class.
 o putGene(GPGene)
Puts a different gene into the place of this class.

Variables

 o container
  public GPContainer container
The container that holds a particular gene.
 o index
  public int index
The index of a particular gene within its container.
 o count
  public int count
Used by a search function to count the number of genes to pass or the number that were passed.

Constructors

 o GPGeneReference
  public GPGeneReference()
Instantiates a gene reference for later use.
 o GPGeneReference
  public GPGeneReference(GPContainer container,
                         int index)
Instantiates a gene reference with a known container and index.
 o GPGeneReference
  public GPGeneReference(GPGeneReference ref)
Clones another gene reference.

Methods

 o assignRef
  public void assignRef(GPGeneReference ref)
Assigns another gene reference to this one.
 o assignContainer
  public void assignContainer(GPContainer container,
                              int index)
Assigns a particular container and index to this gene reference.
 o getGene
  public GPGene getGene()
Returns the gene referenced by this class.
 o putGene
  public void putGene(GPGene g)
Puts a different gene into the place of this class.

All Packages  Class Hierarchy  This Package  Previous  Next  Index