com.rubecula.darwin.core
Class Genome_Abstract

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector
              extended by com.rubecula.util.AuditableVector
                  extended by com.rubecula.darwin.core.Genome_Abstract
All Implemented Interfaces:
Genome, Auditable, Identifiable, Serializable, Cloneable, Iterable, Collection, List, RandomAccess
Direct Known Subclasses:
Genome_Diploid, Genome_Haploid

public abstract class Genome_Abstract
extends AuditableVector
implements Genome

Abstract class implementing base methods for the Genome interface.

Author:
Robin Hillyard TODO define this class using generics so that only Locus objects can be added/retrieved.
See Also:
Serialized Form

Field Summary
protected static org.apache.commons.logging.Log log
          The logger for this class.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface com.rubecula.darwin.core.Genome
DIPLOID, HAPLOID
 
Constructor Summary
protected Genome_Abstract(String identifier, int ode, Meiosis meioter, Expression expresser, Factory factory)
          Constructor for a new Genome_Abstract instance.
protected Genome_Abstract(String identifier, int ode, Meiosis meioter, Mutator mutator, Expression expresser, Factory factory)
          Constructor for a new Genome_Abstract instance.
 
Method Summary
 void add(int index, Locus locus)
          Method to add a Locus at the specified index.
 void add(int arg0, Object arg1)
           
 boolean add(Locus locus)
          Method to add a Locus at the end of this Genome.
 Expression getExpresser()
          The implementer of Expression which an application has specified.
 Factory getFactory()
           
 Locus getLocus(int index)
           
 Meiosis getMeioter()
           
 Mutator getMutator()
           
 int getOde()
          Method to return the genetic form for this genome.
 
Methods inherited from class com.rubecula.util.AuditableVector
audit, audit, audit, getIdentifier
 
Methods inherited from class java.util.Vector
add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rubecula.darwin.core.Genome
size
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
The logger for this class.

Constructor Detail

Genome_Abstract

protected Genome_Abstract(String identifier,
                          int ode,
                          Meiosis meioter,
                          Expression expresser,
                          Factory factory)
Constructor for a new Genome_Abstract instance. This type of Genome undergoes no mutations.

Parameters:
identifier - the identifier for this Genome.
ode - the ode (haploid/diploid/etc).
meioter - the implementer of Meiosis.
expresser - an implementer of Expression. which allows any Genotype conforming to this Genome to be expressed as a Phenotype.
factory - the implementer of Factory.

Genome_Abstract

protected Genome_Abstract(String identifier,
                          int ode,
                          Meiosis meioter,
                          Mutator mutator,
                          Expression expresser,
                          Factory factory)
Constructor for a new Genome_Abstract instance.

Parameters:
identifier - the identifier for this Genome.
ode - the ode (haploid/diploid/etc).
meioter - the implementer of Meiosis.
mutator - the implementer of Mutator which will be applied to all new genotypes.
expresser - an implementer of Expression. which allows any Genotype conforming to this Genome to be expressed as a Phenotype.
factory - the implementer of Factory.
Method Detail

add

public void add(int index,
                Locus locus)
Description copied from interface: Genome
Method to add a Locus at the specified index.

Specified by:
add in interface Genome
Parameters:
index - the index at which the new object will appear.
locus - a locus to be inserted into this Genome.
See Also:
List.add(int, java.lang.Object)

add

public void add(int arg0,
                Object arg1)
Specified by:
add in interface List
Overrides:
add in class Vector

add

public boolean add(Locus locus)
Method to add a Locus at the end of this Genome.

Specified by:
add in interface Genome
Parameters:
locus - a locus to be inserted into this Genome.
Returns:
true, always.
See Also:
add(int, Locus)

getExpresser

public Expression getExpresser()
Description copied from interface: Genome
The implementer of Expression which an application has specified.

Specified by:
getExpresser in interface Genome
Returns:
the implementer of Expression for this Genome.

getFactory

public Factory getFactory()
Specified by:
getFactory in interface Genome
Returns:
the factory

getLocus

public Locus getLocus(int index)
Specified by:
getLocus in interface Genome
Returns:
the locus defined by index (0..N)

getMeioter

public Meiosis getMeioter()
Specified by:
getMeioter in interface Genome
Returns:
the application-specified implementer of Meiosis

getMutator

public Mutator getMutator()
Specified by:
getMutator in interface Genome
Returns:
the mutator

getOde

public int getOde()
Description copied from interface: Genome
Method to return the genetic form for this genome.

Specified by:
getOde in interface Genome
Returns:
the "oidity" which will normally be either Genome.HAPLOID, i.e. simple or Genome.DIPLOID, i.e. double.