ca.cas.montecarlo
Class Geometry

java.lang.Object
  extended by ca.cas.montecarlo.Geometry
Direct Known Subclasses:
CircleGeometry

public abstract class Geometry
extends java.lang.Object

A class that extends Geometry represents the spatial relationship of the Chromosomes in a Genome. The Geometry abstract class establishes a standard for how extending geometry subclasses are to be written. The constructor for a subclass may take any number of parameters. Additional methods may be added in order to modify these parameters after an instance of a subclass has been created. The Genome object that is to be used as a basis for this subclass should be set by the driver using the setGenome method. Once a Genome object has been set, the arrange method must be called before any information may be obtained from this subclass.


Field Summary
protected  boolean arranged
           
protected  Genome<Chromosome> gen
           
 
Constructor Summary
Geometry()
          The constructor for the Geometry abstract class.
 
Method Summary
abstract  void arrange(java.util.Random rGen)
          Calling this method causes this Geometry to arrange the Chromosomes from the Genome set by setGenome().
protected  void checkArranged()
           
abstract  double distance(Chromosome chrom1, long location1, Chromosome chrom2, long location2)
          Returns the distance between locations in the Genome.
 void setGenome(Genome<Chromosome> gen)
          This method is intended to be used by the driver to specify the Genome object which this Geometry is to represent an arrangement of.
 long totalBP()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gen

protected Genome<Chromosome> gen

arranged

protected boolean arranged
Constructor Detail

Geometry

public Geometry()
The constructor for the Geometry abstract class.

Method Detail

distance

public abstract double distance(Chromosome chrom1,
                                long location1,
                                Chromosome chrom2,
                                long location2)
                         throws java.lang.Exception
Returns the distance between locations in the Genome. A location is defined as the space between base pairs. The meaning of distance depends on the particular subclass of Geometry being used. The distance of a location to itself should be 0. There are n+1 possible locations on a chromosome which is n base pairs long. This includes the locations on the outside of each telomere. The locations outside the p and q telomeres are defined to be 0 and n respectively. If this method is called and arrange() has not yet been called, an exception should be thrown.

Parameters:
chrom1 - the Chromosome of the first location
location1 - the index of the first location
chrom2 - The Chromosome of the second location
location2 - the index of the second location
Returns:
the distance between location1 on chrom1 and location2 on chrom2 as a double
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

arrange

public abstract void arrange(java.util.Random rGen)
                      throws java.lang.Exception
Calling this method causes this Geometry to arrange the Chromosomes from the Genome set by setGenome(). If no valid Genome has been set, this method should throw an exception. If there are multiple ways of arranging the same Genome according to this Geometry, calling arrange() again after the initial arrangement causes this Geometry to re-arrange the Chromosomes in the Genome set by setGenome(). Otherwise, no change is made in this Geometry by calling arrange() multiple times. Every time a new Genome is set, the arrange method must be called to set an arrangement using the new Genome.

Parameters:
rGen - a Random object to use in creating the arrangement
Throws:
java.lang.Exception - if no valid Genome has been set

setGenome

public void setGenome(Genome<Chromosome> gen)
This method is intended to be used by the driver to specify the Genome object which this Geometry is to represent an arrangement of.

Parameters:
gen - a Genome object

totalBP

public long totalBP()
             throws java.lang.Exception
Throws:
java.lang.Exception

checkArranged

protected void checkArranged()
                      throws java.lang.Exception
Throws:
java.lang.Exception