com.rubecula.darwin.domain.genetics
Class Locus_Random

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.domain.genetics.Locus_
          extended by com.rubecula.darwin.domain.genetics.Locus_Random
All Implemented Interfaces:
Locus, Progenitor, SexLinked, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
Direct Known Subclasses:
Locus_Sex, Locus_Triversian, Locus_TS

public abstract class Locus_Random
extends Locus_

Lifespan: permanent. Default implementation of Locus which uses a random number source to pick alleles during seeding.

Author:
Robin Hillyard

Field Summary
protected  Randomizer _random
           
 
Fields inherited from class com.rubecula.darwin.domain.genetics.Locus_
LOG
 
Fields inherited from interface com.rubecula.darwin.domain.helper.Locus
ID_SEX
 
Fields inherited from interface net.sf.tostring0.IToString
ANGBR_OPEN, ANGBRA_CLSE, BRA_CLSE, BRA_OPEN, BRCE_OPEN, BRCS_CLSE, COLON, LIST_SEPARATOR, MAX_ELEMENTS_DEFAULT, S_MT, S_PERCENT, SEPARATOR, SPACE
 
Constructor Summary
Locus_Random(java.lang.String identifier, org.apache.commons.math.random.RandomGenerator random)
           
 
Method Summary
 java.lang.String add(Allele allele, int frequency)
          This is used only when a mutation occurs.
protected  void onChange()
          This method is invoked whenever the set of alleles or their frequencies changes
 java.lang.String pickAllele()
          Randomly choose a particular allele from the possible alleles at this locus.
 void setAlleles(java.util.Map<? extends Allele,java.lang.Integer> map)
          Preferred method of setting up the allele/frequency map (rather than using add()).
 
Methods inherited from class com.rubecula.darwin.domain.genetics.Locus_
addAllele, equals, getAllele, getAlleleMap, getAlleles, getAlleleValues, getChromosome, getFrequencies, getIdentifier, getKey, getParent, getPolygenic, hashCode, isLegal, isSexLinked, makeGene, putAllele, setParent, setPolygenic, size
 
Methods inherited from class net.sf.tostring0.AToString
toString, toString, toStringBrief, toStringId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.tostring0.IToString
toString, toStringBrief, toStringId
 

Field Detail

_random

protected final Randomizer _random
Constructor Detail

Locus_Random

public Locus_Random(java.lang.String identifier,
                    org.apache.commons.math.random.RandomGenerator random)
Parameters:
identifier -
random -
Method Detail

add

public java.lang.String add(Allele allele,
                            int frequency)
This is used only when a mutation occurs. Normally the legal alleles at the start of an evolution are set using setAlleles(Map).

Parameters:
allele - An allele which can possibly appear at this locus.
frequency - The relative frequency with which this allele appears at this locus in the gene pool. This is used when seeding a population.
Returns:
the result of invoking Locus_.putAllele(Allele, int) with allele and frequency as the parameters. TODO eliminating this and using putAllele directly.
See Also:
Locus.add(com.rubecula.darwin.domain.helper.Allele, int)

pickAllele

public java.lang.String pickAllele()
Randomly choose a particular allele from the possible alleles at this locus.

Returns:
the key to the allele. XXX this should probably be combined with the Seed stuff.
See Also:
Locus.pickAllele()

setAlleles

public void setAlleles(java.util.Map<? extends Allele,java.lang.Integer> map)
Description copied from class: Locus_
Preferred method of setting up the allele/frequency map (rather than using add()).

Overrides:
setAlleles in class Locus_
See Also:
Locus_.setAlleles(Map)

onChange

protected void onChange()
Description copied from class: Locus_
This method is invoked whenever the set of alleles or their frequencies changes

Overrides:
onChange in class Locus_


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