org.jgap.data
Class DataTreeBuilder

java.lang.Object
  extended byorg.jgap.data.DataTreeBuilder

public class DataTreeBuilder
extends java.lang.Object

Builds a tree structure from Genes, Chrosomes or from a Genotype.

Generated result is generic data type usable for concrete persistence strategies, including XML documents, writing an object to a file or stream etc.

Since:
2.0
Author:
Klaus Meffert

Method Summary
static DataTreeBuilder getInstance()
           
static void main(java.lang.String[] args)
           
 IDataCreators representChromosomeAsDocument(Chromosome a_subject)
          Represent a Chromosome as a generic data type document, including its contained Gene instances.
 IDataElement representChromosomeAsElement(Chromosome a_subject)
          Represent a Chromosome as a generic data element, including its contained Gene instances.
 IDataElement representGeneAsElement(Gene a_gene)
          Represent a Gene as a generic data element.
 IDataElement representGenesAsElement(Gene[] a_geneValues)
          Represent Genes as a generic data type element.
 IDataCreators representGenotypeAsDocument(Genotype a_subject)
          Represent a Genotype as a generic data document, including its population of Chromosome instances.
 IDataElement representGenotypeAsElement(Genotype a_subject)
          Represent a Genotype as a generic data element, including its population of Chromosome instances.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DataTreeBuilder getInstance()
Returns:
the singleton instance of this class
Since:
2.0

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

representGenotypeAsDocument

public IDataCreators representGenotypeAsDocument(Genotype a_subject)
                                          throws java.lang.Exception
Represent a Genotype as a generic data document, including its population of Chromosome instances.

Parameters:
a_subject - The genotype to represent
Returns:
a generic document object representing the given Genotype.
Throws:
java.lang.Exception
Since:
2.0

representGenotypeAsElement

public IDataElement representGenotypeAsElement(Genotype a_subject)
                                        throws java.lang.Exception
Represent a Genotype as a generic data element, including its population of Chromosome instances. This may be useful in scenarios where representation as an entire document is undesirable, such as when the representation of this Genotype is to be combined with other elements in a single document.

Parameters:
a_subject - The genotype to represent
Returns:
an element object representing the given Genotype.
Throws:
java.lang.Exception
Since:
2.0

representChromosomeAsDocument

public IDataCreators representChromosomeAsDocument(Chromosome a_subject)
                                            throws java.lang.Exception
Represent a Chromosome as a generic data type document, including its contained Gene instances.

Parameters:
a_subject - The chromosome to represent
Returns:
a document object representing the given Chromosome.
Throws:
java.lang.Exception
Since:
2.0

representChromosomeAsElement

public IDataElement representChromosomeAsElement(Chromosome a_subject)
                                          throws java.lang.Exception
Represent a Chromosome as a generic data element, including its contained Gene instances. This may be useful in scenarios where representation as an entire document is undesirable, such as when the representation of this Chromosome is to be combined with other elements in a single document.

Parameters:
a_subject - The chromosome to represent
Returns:
an element object representing the given Chromosome.
Throws:
java.lang.Exception
Since:
2.0

representGenesAsElement

public IDataElement representGenesAsElement(Gene[] a_geneValues)
                                     throws java.lang.Exception
Represent Genes as a generic data type element.

Parameters:
a_geneValues - The genes to represent
Returns:
an element object representing the given genes.
Throws:
java.lang.Exception
Since:
2.0

representGeneAsElement

public IDataElement representGeneAsElement(Gene a_gene)
                                    throws java.lang.Exception
Represent a Gene as a generic data element.

Parameters:
a_gene - The Gene to represent
Returns:
an element object representing the given gene.
Throws:
java.lang.Exception
Since:
2.0