com.rubecula.darwin.domain.genetics
Class GenomeFactory

java.lang.Object
  extended by com.rubecula.darwin.domain.genetics.GenomeFactory

public final class GenomeFactory
extends java.lang.Object

Factory Class to create Genome objects. Applications can't change this class (it is final) but they can override the methods which call these methods. XXX consider renaming this and refactoring some of the methods to return Genotype objects.

Author:
Robin Hillyard

Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Method Summary
static Genome makeGamete(Genomic genomic)
          Factory method to create a haploid genome which conforms to the given Genomic and with genes where the alleles have been picked for each locus according to the Locus.pickAllele() method.
static Genome makeGenome(java.lang.Class<? extends Genome> clazz, Genomic genomic, java.lang.Object... parameters)
          TEST
static Genome makeLinear(Genomic genomic, int ploidy)
          Factory method to create an empty genome which conforms to the given Genomic and is diploid or haploid according to the ploidy parameter.
static Genome makeZygote(Genome gameteX, Genes gameteY)
           
static Genome makeZygote(Genomic genomic)
          Method to create (from "whole cloth") a new diploid Genome, by creating two gametes (using makeGamete(com.rubecula.darwin.domain.helper.Genomic) and then fertilizing them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Method Detail

makeGamete

public static Genome makeGamete(Genomic genomic)
Factory method to create a haploid genome which conforms to the given Genomic and with genes where the alleles have been picked for each locus according to the Locus.pickAllele() method.

Parameters:
genomic - the genomic which defines the possible gene alleles.
Returns:
the resulting genome.

makeGenome

public static Genome makeGenome(java.lang.Class<? extends Genome> clazz,
                                Genomic genomic,
                                java.lang.Object... parameters)
TEST

Parameters:
clazz - the class of Genome to instantiate, which must have a constructor of form Genome(Genomic,Object[]).
genomic - the genomic
parameters - the parameters for the constructor
Returns:
a newly constructed Genome.

makeLinear

public static Genome makeLinear(Genomic genomic,
                                int ploidy)
Factory method to create an empty genome which conforms to the given Genomic and is diploid or haploid according to the ploidy parameter. Note the will be no genes in the result. TODO consider returning a Genotype_, for example a Genotype_Linear, which currently does not exist.

Parameters:
genomic - the genomic to which the resulting genome will conform.
ploidy -
Returns:
a newly constructed empty linear genome with the given ploidy.

makeZygote

public static Genome makeZygote(Genome gameteX,
                                Genes gameteY)
Parameters:
gameteX -
gameteY -
Returns:
the result of fertilizing gameteX with gameteY

makeZygote

public static Genome makeZygote(Genomic genomic)
Method to create (from "whole cloth") a new diploid Genome, by creating two gametes (using makeGamete(com.rubecula.darwin.domain.helper.Genomic) and then fertilizing them. XXX check that this name is reasonably appropriate.

Parameters:
genomic -
Returns:
a new diploid genome.


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.