com.rubecula.darwin.core
Class Factory_Abstract

java.lang.Object
  extended by com.rubecula.darwin.core.Factory_Abstract
All Implemented Interfaces:
Factory
Direct Known Subclasses:
Factory_Default

public abstract class Factory_Abstract
extends Object
implements Factory

Abstract Factory.

Author:
Robin

Field Summary
static String P_ALLELE0
          allele0
static String P_ALLELE1
          allele1
static String P_SEX
          sex
 
Constructor Summary
protected Factory_Abstract()
           
 
Method Summary
 Allele makeAllele(Object value)
          Factory method to instantiate a new Allele of the appropriate class, with an auto-generated key.
 Allele makeAllele(Object key, Object value)
          Factory method to instantiate a new Allele of the appropriate class.
static Map<String,Object> makeDiploidAlleleMap(Allele x, Allele y)
          Class convenience method to create a map suitable for calling makeGene().
 Gene makeGene(int ode)
          Factory method to instantiate a new Gene of the appropriate class.
 Genotype makeGenotype(int ode)
          Factory method to instantiate a new genotype of the appropriate class.
static Map<String,Object> makeHaploidAlleleMap(Allele x)
          Class convenience method to create a map suitable for calling makeGene().
 Organism makeOrganism(Population population, Genotype genotype)
          Factory method to instantiate a new organism of the appropriate class, with a population-specific auto-generated identifier.
 Organism makeOrganism(Population population, Genotype genotype, Map<String,Object> properties)
          Factory method to instantiate a new organism of the appropriate class, with a population-specific auto-generated identifier.
 Organism makeOrganism(String identifier, Population population, Genotype genotype)
          Factory method to instantiate a new organism of the appropriate class.
 Phenotype makePhenotype()
          Factory method to instantiate a new phenotype of the appropriate class.
static Map<String,Object> makeSexMap(boolean female)
          Class convenience method to create a map suitable for calling makeOrganism().
 Trait makeTrait(String identifier)
          Factory method to instantiate a new Trait of the appropriate class, without an initial value.
 Trait makeTrait(String identifier, Map<String,Object> properties)
          Factory method to instantiate a new Trait of the appropriate class, without an initial value.
 Trait makeTrait(String identifier, Object value)
          Factory method to instantiate a new Trait of the appropriate class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.rubecula.darwin.core.Factory
makeAllele, makeAllele, makeGene, makeGenotype, makeOrganism, makePhenotype, makeTrait
 

Field Detail

P_ALLELE1

public static final String P_ALLELE1
allele1

See Also:
Constant Field Values

P_ALLELE0

public static final String P_ALLELE0
allele0

See Also:
Constant Field Values

P_SEX

public static final String P_SEX
sex

See Also:
Constant Field Values
Constructor Detail

Factory_Abstract

protected Factory_Abstract()
Method Detail

makeDiploidAlleleMap

public static Map<String,Object> makeDiploidAlleleMap(Allele x,
                                                      Allele y)
Class convenience method to create a map suitable for calling makeGene().

Parameters:
x - allele for position P_ALLELE0
y - allele for position P_ALLELE1
Returns:
a instance of Map objects

makeHaploidAlleleMap

public static Map<String,Object> makeHaploidAlleleMap(Allele x)
Class convenience method to create a map suitable for calling makeGene().

Parameters:
x - an allele for position P_ALLELE0
Returns:
a instance of Map objects

makeSexMap

public static Map<String,Object> makeSexMap(boolean female)
Class convenience method to create a map suitable for calling makeOrganism().

Parameters:
female - a boolean for the sex (true for female).
Returns:
a instance of Map objects with one element with the key P_SEX and the value (as a Boolean) female.

makeAllele

public Allele makeAllele(Object value)
Description copied from interface: Factory
Factory method to instantiate a new Allele of the appropriate class, with an auto-generated key.

Specified by:
makeAllele in interface Factory
Parameters:
value - the value of the new allele.
Returns:
a newly constructed instance of Allele.

makeAllele

public Allele makeAllele(Object key,
                         Object value)
Description copied from interface: Factory
Factory method to instantiate a new Allele of the appropriate class.

Specified by:
makeAllele in interface Factory
Parameters:
key - the key of the new allele.
value - the value of the new allele.
Returns:
a newly constructed instance of Allele.

makeGene

public Gene makeGene(int ode)
Description copied from interface: Factory
Factory method to instantiate a new Gene of the appropriate class.

Specified by:
makeGene in interface Factory
Parameters:
ode - the number of alleles to be found at a particular locus (1 if haploid, 2 if diploid).
Returns:
a newly constructed instance of Gene.

makeGenotype

public Genotype makeGenotype(int ode)
Description copied from interface: Factory
Factory method to instantiate a new genotype of the appropriate class.

Specified by:
makeGenotype in interface Factory
Parameters:
ode - the number of alleles to be found at a particular locus (1 if haploid, 2 if diploid).
Returns:
a newly constructed instance of Genotype.

makeOrganism

public Organism makeOrganism(Population population,
                             Genotype genotype)
Description copied from interface: Factory
Factory method to instantiate a new organism of the appropriate class, with a population-specific auto-generated identifier.

Specified by:
makeOrganism in interface Factory
Parameters:
population - the population into which the new organism will be "born".
genotype - the genotype which defines the new organism.
Returns:
a newly constructed instance of Organism.

makeOrganism

public Organism makeOrganism(Population population,
                             Genotype genotype,
                             Map<String,Object> properties)
Description copied from interface: Factory
Factory method to instantiate a new organism of the appropriate class, with a population-specific auto-generated identifier.

Specified by:
makeOrganism in interface Factory
Parameters:
population - the population into which the new organism will be "born".
genotype - the genotype which defines the new organism.
properties - a map which specifies any additional properties required at instantation time.
Returns:
a newly constructed instance of Organism.

makeOrganism

public Organism makeOrganism(String identifier,
                             Population population,
                             Genotype genotype)
Description copied from interface: Factory
Factory method to instantiate a new organism of the appropriate class.

Specified by:
makeOrganism in interface Factory
Parameters:
identifier - the identifier for the new organism.
population - the population into which the new organism will be "born".
genotype - the genotype which defines the new organism.
Returns:
a newly constructed instance of Organism.

makePhenotype

public Phenotype makePhenotype()
Description copied from interface: Factory
Factory method to instantiate a new phenotype of the appropriate class.

Specified by:
makePhenotype in interface Factory
Returns:
a newly constructed instance of Phenotype.

makeTrait

public Trait makeTrait(String identifier)
Description copied from interface: Factory
Factory method to instantiate a new Trait of the appropriate class, without an initial value.

Specified by:
makeTrait in interface Factory
Parameters:
identifier - the identifier of the new trait.
Returns:
a newly constructed instance of Trait.

makeTrait

public Trait makeTrait(String identifier,
                       Map<String,Object> properties)
Description copied from interface: Factory
Factory method to instantiate a new Trait of the appropriate class, without an initial value.

Specified by:
makeTrait in interface Factory
Parameters:
identifier - the identifier of the new trait.
properties - a map which specifies any additional properties required at instantation time.
Returns:
a newly constructed instance of Trait.

makeTrait

public Trait makeTrait(String identifier,
                       Object value)
Description copied from interface: Factory
Factory method to instantiate a new Trait of the appropriate class.

Specified by:
makeTrait in interface Factory
Parameters:
identifier - the identifier of the new trait.
value - the initial value of the new trait.
Returns:
a newly constructed instance of Trait.