com.rubecula.darwin.core
Class Gene_Abstract

java.lang.Object
  extended by com.rubecula.util.AuditableObject
      extended by com.rubecula.darwin.core.Gene_Abstract
All Implemented Interfaces:
Gene, Auditable, Identifiable, Cloneable
Direct Known Subclasses:
Gene_Diploid, Gene_Haploid

public abstract class Gene_Abstract
extends AuditableObject
implements Gene

This abstract class represents a particular gene at a locus of a genome. In a diploid system there will be two genes at a locus. In most systems there is one. A gene can take as its "value" an Allele which is valid at the given locus.

Version:
$Revision: 1.5 $
Author:
Robin Hillyard

Field Summary
protected static org.apache.commons.logging.Log log
          The logger for this class.
 
Constructor Summary
protected Gene_Abstract(int ode)
          Primary protected constructor to create a Gene_Abstract which appears at a particular locus.
 
Method Summary
 String audit(String label)
          Method to return a detailed string from an arithmetical object for debugging purposes.
 Object clone()
           
 Allele getAllele(int index)
          Accessor method to return the indexth allele for this gene.
 String getIdentifier()
          Method to get the specific identifier for an object.
 int getOde()
          Method to return the genetic form for this gene.
protected  Gene mutate(Genome genome)
          Method to get a mutated copy of a Gene.
 void setAllele(int index, Allele allele)
          Mutator method to set the indexth allele for this gene.
protected  void setAlleles(Allele[] alleles)
           
 String toString()
           
 
Methods inherited from class com.rubecula.util.AuditableObject
audit, audit, audit
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

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

Constructor Detail

Gene_Abstract

protected Gene_Abstract(int ode)
Primary protected constructor to create a Gene_Abstract which appears at a particular locus. The array _Alleles of size ode is initialized with no elements specified.

Method Detail

audit

public String audit(String label)
Method to return a detailed string from an arithmetical object for debugging purposes.

Specified by:
audit in interface Auditable
Parameters:
label - String: the label to associate with the data
Returns:
the detailed string.

clone

public Object clone()
Overrides:
clone in class AuditableObject

getAllele

public Allele getAllele(int index)
Description copied from interface: Gene
Accessor method to return the indexth allele for this gene.

Specified by:
getAllele in interface Gene
Parameters:
index - which allele to get.
Returns:
the value of the allele at that index.

getIdentifier

public String getIdentifier()
Description copied from interface: Identifiable
Method to get the specific identifier for an object.

Specified by:
getIdentifier in interface Identifiable
Returns:
null (Genes are not identified - loci are).
See Also:
Identifiable.getIdentifier()

getOde

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

Specified by:
getOde in interface Gene
Returns:
the number of alleles for this gene (i.e. haploid or diploid).

setAllele

public void setAllele(int index,
                      Allele allele)
Description copied from interface: Gene
Mutator method to set the indexth allele for this gene.

Specified by:
setAllele in interface Gene
Parameters:
index - which allele is to be set.
allele - the value of the allele to set.

toString

public String toString()
Overrides:
toString in class Object

setAlleles

protected void setAlleles(Allele[] alleles)
Parameters:
alleles - the alleles to set (ignored)
Throws:
UnsupportedOperationException

mutate

protected Gene mutate(Genome genome)
Method to get a mutated copy of a Gene.

Parameters:
genome -
Returns:
a mutated copy (which may be identical if no mutations have occurred)