com.rubecula.darwin.domain.genetics
Class Chromosome_

java.lang.Object
  extended by net.sf.tostring0.AToString
      extended by com.rubecula.darwin.domain.genetics.Chromosome_
All Implemented Interfaces:
Chromosome, Progenitor, SexLinked, net.sf.tostring0.Identifiable, net.sf.tostring0.IToString
Direct Known Subclasses:
Chromosome_NoSex, Chromosome_Sex

public abstract class Chromosome_
extends net.sf.tostring0.AToString
implements Chromosome

Abstract class implementing base methods for the Chromosome interface. There is no specific support for Epistasis since the ordering of the loci set that is returned by getLoci() is essentially random. If you need to allow certain genes to suppress the expression of other genes, then it would probably be best to extend this class.

Author:
Robin Hillyard

Field Summary
protected static org.apache.commons.logging.Log LOG
          The logger for this class.
 
Fields inherited from interface com.rubecula.darwin.domain.helper.Chromosome
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
protected Chromosome_(java.lang.String identifier, boolean sexLinked)
           
 
Method Summary
protected  void add(int index, Locus locus)
           
protected  boolean add(Locus o)
           
protected  boolean addAll(java.util.Collection<? extends Locus> loci)
           
 void addLocus(int index, Locus locus)
          add locus and set the locus to point to this Chromosome as its owner.
 boolean addLocus(Locus locus)
          Method to add a Locus at the end of this Genomic.
protected  void clear()
           
protected  boolean contains(java.lang.Object locus)
           
 boolean equals(java.lang.Object obj)
           
 int getCount()
           
 Genomic getGenomic()
           
 java.lang.String getIdentifier()
           
 java.util.Collection<Locus> getLoci()
          Getter/setter typically used by reflection.
 Locus getLocus(int index)
           
 int hashCode()
           
protected  int indexOf(java.lang.Object locus)
           
protected  boolean isEmpty()
           
 boolean isSexLinked()
           
protected  int lastIndexOf(java.lang.Object locus)
           
protected  Locus remove(int index)
          Actually remove a locus, even if it is the sex locus (unless this method is overridden by Chromosome_Sex.
protected  boolean remove(java.lang.Object locus)
          Actually remove a locus, even if it is the sex locus (unless this method is overridden by Chromosome_Sex.
protected  boolean retainAll(java.util.Collection<?> c)
           
 void setGenomic(Genomic genomic)
           
 void setLoci(java.util.Collection<Locus> loci)
          This is now the preferred method to set the loci.
protected  java.lang.Object[] toArray()
           
protected
<T> T[]
toArray(T[] a)
           
 
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

LOG

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

Constructor Detail

Chromosome_

protected Chromosome_(java.lang.String identifier,
                      boolean sexLinked)
Parameters:
identifier - the identifier for this chromosome.
sexLinked - true if this chromosome is sex-linked
Method Detail

addLocus

public void addLocus(int index,
                     Locus locus)
              throws GeneticsException
add locus and set the locus to point to this Chromosome as its owner. Note: do not use this to add a polygenic loci, except for the first of each group.

Specified by:
addLocus in interface Chromosome
Parameters:
index -
locus -
Throws:
GeneticsException
See Also:
Chromosome.addLocus(int, com.rubecula.darwin.domain.helper.Locus)

addLocus

public boolean addLocus(Locus locus)
                 throws GeneticsException
Method to add a Locus at the end of this Genomic. Generally, we prefer to use setLoci(Collection) instead.

Specified by:
addLocus in interface Chromosome
Parameters:
locus - a locus to be inserted into this Genomic.
Returns:
true, always.
Throws:
GeneticsException
See Also:
addLocus(int, Locus)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getCount

public int getCount()
Specified by:
getCount in interface Chromosome
Returns:
the number of loci in this chromosome.
See Also:
Chromosome.getCount()

getGenomic

public Genomic getGenomic()
Specified by:
getGenomic in interface Chromosome
Returns:
the Genomic to which this chromosome belongs.
See Also:
Chromosome.getGenomic()

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in interface net.sf.tostring0.Identifiable
Returns:
result of invoking Identifiable.getIdentifier() on _loci.
See Also:
Identifiable.getIdentifier()

getLoci

public java.util.Collection<Locus> getLoci()
Description copied from interface: Chromosome
Getter/setter typically used by reflection.

Specified by:
getLoci in interface Chromosome
Returns:
the loci as a collection of Locus objects.

getLocus

public Locus getLocus(int index)
Specified by:
getLocus in interface Chromosome
Returns:
the indexth locus.
See Also:
Chromosome.getLocus(int)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

isSexLinked

public boolean isSexLinked()
Specified by:
isSexLinked in interface SexLinked
Returns:
value of field _sexLinked.
See Also:
SexLinked.isSexLinked()

setGenomic

public void setGenomic(Genomic genomic)
Specified by:
setGenomic in interface Chromosome
See Also:
Chromosome.setGenomic(com.rubecula.darwin.domain.helper.Genomic)

setLoci

public void setLoci(java.util.Collection<Locus> loci)
This is now the preferred method to set the loci. Any prior loci will be forgotten. Note: do not include any polygenic loci, except for the first of each group.

Specified by:
setLoci in interface Chromosome
Parameters:
loci -

add

protected void add(int index,
                   Locus locus)
            throws GeneticsException
Throws:
GeneticsException

add

protected boolean add(Locus o)

addAll

protected boolean addAll(java.util.Collection<? extends Locus> loci)

clear

protected void clear()

contains

protected boolean contains(java.lang.Object locus)

indexOf

protected int indexOf(java.lang.Object locus)

isEmpty

protected boolean isEmpty()

lastIndexOf

protected int lastIndexOf(java.lang.Object locus)

remove

protected Locus remove(int index)
Actually remove a locus, even if it is the sex locus (unless this method is overridden by Chromosome_Sex.

Parameters:
index -
Returns:
the element previously at the specified position.

remove

protected boolean remove(java.lang.Object locus)
Actually remove a locus, even if it is the sex locus (unless this method is overridden by Chromosome_Sex.

Parameters:
locus -
Returns:
true if the list contained the object.

retainAll

protected boolean retainAll(java.util.Collection<?> c)

toArray

protected java.lang.Object[] toArray()

toArray

protected <T> T[] toArray(T[] a)


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