com.rubecula.darwin.examples.pepperedmoth
Class Mutator_PepperedMoth

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.domain.genetics.Mutator_
          extended by com.rubecula.darwin.domain.genetics.Mutator_Random
              extended by com.rubecula.darwin.examples.pepperedmoth.Mutator_PepperedMoth
All Implemented Interfaces:
Chancy, Mutator, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString

public class Mutator_PepperedMoth
extends Mutator_Random

This mutator is responsible for keeping the carbonaria allele in the population (or, conceivably, the typica allele) Every now and then, the copying of the gene goes wrong and the other allele is used instead. The frequency of errors can be set dynamically. Note that this mutator does not override the Mutator.mutate(com.rubecula.darwin.domain.helper.Genome) method so that the only type of mutation is switching alleles (no replication, deletion, etc.)

Author:
Robin Hillyard

Field Summary
 
Fields inherited from class com.rubecula.darwin.domain.genetics.Mutator_Random
_random
 
Fields inherited from class com.rubecula.darwin.domain.genetics.Mutator_
LOG
 
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
Mutator_PepperedMoth(org.apache.commons.math.random.RandomGenerator random)
           
Mutator_PepperedMoth(org.apache.commons.math.random.RandomGenerator random, int odds)
           
 
Method Summary
static Allele makeAllele(Locus locus, boolean which)
          TODO consider copying from the existing set of alleles rather than creating new instances.
 Allele mutate(Allele allele)
          If we get index 1 from the randomizer, we flip the type of allele.
 
Methods inherited from class com.rubecula.darwin.domain.genetics.Mutator_Random
getRandom, setBands, setOdds
 
Methods inherited from class com.rubecula.darwin.domain.genetics.Mutator_
addToLocusIfUnknown, equals, getIdentifier, hashCode, isComplementary, isIdentity, mutate, normalize, simplify
 
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
 

Constructor Detail

Mutator_PepperedMoth

public Mutator_PepperedMoth(org.apache.commons.math.random.RandomGenerator random)
Parameters:
random -

Mutator_PepperedMoth

public Mutator_PepperedMoth(org.apache.commons.math.random.RandomGenerator random,
                            int odds)
Parameters:
random -
odds -
Method Detail

makeAllele

public static Allele makeAllele(Locus locus,
                                boolean which)
TODO consider copying from the existing set of alleles rather than creating new instances.

Parameters:
locus -
which - the particular allele to make (either true for melanistic, or false for non-melanistic)
Returns:
a newly constructed allele

mutate

public Allele mutate(Allele allele)
If we get index 1 from the randomizer, we flip the type of allele.

Specified by:
mutate in interface Mutator
Overrides:
mutate in class Mutator_Random
Parameters:
allele - the original allele
Returns:
either the original allele or a mutated version of it. TODO it seems to me now that this mutation should operate on a Gene, not on an Allele, but there again we have to remember that the word "gene" is used in two different ways in common parlance.
See Also:
Mutator_.mutate(com.rubecula.darwin.domain.helper.Allele)


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