org.concord.biologica.ui
Class MeiosisChromosomeModel

java.lang.Object
  |
  +--org.concord.biologica.ui.MeiosisChromosomeModel

public final class MeiosisChromosomeModel
extends java.lang.Object

MeiosisChromosomeModel contains the data describing the meiosis state for a given chromosome. It does not contain the code for drawing the animation as that is in the view objects that show meiosis.

This class and the associated meiosis model class assume a display space of 0 to 1000 by 0 to 1000 and all locations are within that range. This means a user of these model classes must scale locations appropriately from this coordinate system to their own in order to draw the chromosomes.

Version:
$Revision: 1.3 $ $Date: 2002/04/05 20:27:07 $
Author:
$Author: qliao $

Field Summary
static int BOTTOM_LEFT_GAMETE_CHROMOSOME
           
static int BOTTOM_RIGHT_GAMETE_CHROMOSOME
           
static int FIRST_STRAND
           
static int LEFT_DAUGHTER_CELL_CHROMOSOME
           
static int ORIG_CELL_CHROMOSOME
          Types of chromosome models
static int P_STRAND_ONE
          Types of chromosome model strands
static int P_STRAND_TWO
           
static int Q_STRAND_ONE
           
static int Q_STRAND_TWO
           
static int RIGHT_DAUGHTER_CELL_CHROMOSOME
           
static int SECOND_STRAND
           
static int TOP_LEFT_GAMETE_CHROMOSOME
           
static int TOP_RIGHT_GAMETE_CHROMOSOME
           
static int UNSPECIFIED_STRAND
          Number of chromosome model strands, used in creating gamete chromosome models only.
 
Constructor Summary
MeiosisChromosomeModel(MeiosisModel aMeiosisModel, OrganismChromosome anOrganismChromosome, int aMeiosisChromosomeModelType, MeiosisChromosomeModel aPreviousMeiosisChromosomeModel, int aPreviousMeiosisChromosomeModelStrand, java.awt.Rectangle anEnclosingViewRectangle, int aVisibleChromosomePairNumber, java.awt.Color aColor)
          Creates a new instance of MeiosisChromosomeModel with the given chromosome, meiosis model, type and previous chromosome model.
 
Method Summary
 void clearTemporaryOffsets()
          Clear temporary offsets.
 void delete()
          Delete this chromosome model.
 float getAnglePStrandAtCentromereAtLastStep()
          Get the angle of the P strand of the chromosome at the centromere at the last step of this chromosome's portion of meiosis.
 float getAngleQStrandAtCentromereAtLastStep()
          Get the angle of the Q strand of the chromosome at the centromere at the last step of this chromosome's portion of meiosis.
 OrganismChromosome getChromosome()
          Get the chromosome for this model.
 int getChromosomeModelType()
          Get the chromosome model type of this chromosome model
 int getNumberType()
          Get the number/type of this chromosome model, zero if no chromosome.
 MeiosisChromosomeModel getPreviousMeiosisChromosomeModel()
          Return the previous meiosis chromosome model.
 OrganismAllele[] getPStrandOneAlleles()
          Get the array of organism alleles for P strand one.
 java.awt.Color[] getPStrandOneColors()
          Get the array of Colors for P strand one.
 OrganismAllele[] getPStrandTwoAlleles()
          Get the array of organism alleles for P strand two.
 java.awt.Color[] getPStrandTwoColors()
          Get the array of Colors for P strand two.
 OrganismAllele[] getQStrandOneAlleles()
          Get the array of organism alleles for Q strand one.
 java.awt.Color[] getQStrandOneColors()
          Get the array of Colors for Q strand one.
 OrganismAllele[] getQStrandTwoAlleles()
          Get the array of organism alleles for Q strand two.
 java.awt.Color[] getQStrandTwoColors()
          Get the array of Colors for Q strand two.
 OrganismAllele[] getStrandAlleles(int aStrand)
          Get the array of Alleles for the given strand.
 java.awt.Color[] getStrandColors(int aStrand)
          Get the array of Colors for the given strand
 int getXCentromereAtStep(int aStep)
          Get the X centromere location as an int at the given meiosis step (NOT the array index!!).
 int[] getXPStrandOnePoints(int aMeiosisStep)
          Get the array of int's for x coordinates of P strand one at the given meiosis step.
 int[] getXPStrandTwoPoints(int aMeiosisStep)
          Get the array of int's for x coordinates of P strand two at the given meiosis step.
 int[] getXQStrandOnePoints(int aMeiosisStep)
          Get the array of int's for x coordinates of Q strand one at the given meiosis step.
 int[] getXQStrandTwoPoints(int aMeiosisStep)
          Get the array of int's for x coordinates of Q strand two at the given meiosis step.
 int getXTemporaryOffset()
          Get the X temporary offset of this chromosome.
 int getYCentromereAtStep(int aStep)
          Get the Y centromere location as an int at the given meiosis step (NOT the array index!!).
 int[] getYPStrandOnePoints(int aMeiosisStep)
          Get the array of int's for y coordinates of P strand one at the given meiosis step.
 int[] getYPStrandTwoPoints(int aMeiosisStep)
          Get the array of int's for y coordinates of P strand two at the given meiosis step.
 int[] getYQStrandOnePoints(int aMeiosisStep)
          Get the array of int's for y coordinates of Q strand one at the given meiosis step.
 int[] getYQStrandTwoPoints(int aMeiosisStep)
          Get the array of int's for y coordinates of Q strand two at the given meiosis step.
 int getYTemporaryOffset()
          Get the Y temporary offset of this chromosome.
 boolean isVisible()
          Get whether this model is visible (true) or not visible (false).
 void setAlleleAndColorVectors(java.awt.Color aDefaultColor)
          Set the vectors for the alleles and colors of this meiosis chromosome model.
 void setEnclosingViewRectangle(java.awt.Rectangle newEnclosingViewRectangle)
          Set the enclosing rectangle for the view containing a display of this chromosome model.
 void setMeiosisChromosomeModelType(int newType)
          Set chromosome model type.
 void setPreviousMeiosisChromosomeModel(MeiosisChromosomeModel aPreviousMeiosisChromosomeModel)
          Set the previous chromosome model of this chromosome model.
 void setPStrandOneAlleles(OrganismAllele[] arr)
           
 void setPStrandOneColors(java.awt.Color[] arr)
           
 void setPStrandTwoAlleles(OrganismAllele[] arr)
           
 void setPStrandTwoColors(java.awt.Color[] arr)
           
 void setQStrandOneAlleles(OrganismAllele[] arr)
           
 void setQStrandOneColors(java.awt.Color[] arr)
           
 void setQStrandTwoAlleles(OrganismAllele[] arr)
           
 void setQStrandTwoColors(java.awt.Color[] arr)
           
 void setStrandAlleles(int aStrand, OrganismAllele[] alleles)
          Set the array of Alleles for the given strand.
 void setStrandColors(int aStrand, java.awt.Color[] colors)
          Set the array of Colors for the given strand.
 void setTemporaryOffsets(int anXTemporaryOffset, int aYTemporaryOffset)
          Set the temporary offsets of this chromosome.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORIG_CELL_CHROMOSOME

public static final int ORIG_CELL_CHROMOSOME
Types of chromosome models

LEFT_DAUGHTER_CELL_CHROMOSOME

public static final int LEFT_DAUGHTER_CELL_CHROMOSOME

RIGHT_DAUGHTER_CELL_CHROMOSOME

public static final int RIGHT_DAUGHTER_CELL_CHROMOSOME

TOP_LEFT_GAMETE_CHROMOSOME

public static final int TOP_LEFT_GAMETE_CHROMOSOME

BOTTOM_LEFT_GAMETE_CHROMOSOME

public static final int BOTTOM_LEFT_GAMETE_CHROMOSOME

TOP_RIGHT_GAMETE_CHROMOSOME

public static final int TOP_RIGHT_GAMETE_CHROMOSOME

BOTTOM_RIGHT_GAMETE_CHROMOSOME

public static final int BOTTOM_RIGHT_GAMETE_CHROMOSOME

P_STRAND_ONE

public static final int P_STRAND_ONE
Types of chromosome model strands

Q_STRAND_ONE

public static final int Q_STRAND_ONE

P_STRAND_TWO

public static final int P_STRAND_TWO

Q_STRAND_TWO

public static final int Q_STRAND_TWO

UNSPECIFIED_STRAND

public static final int UNSPECIFIED_STRAND
Number of chromosome model strands, used in creating gamete chromosome models only. This tells the gamete chromosome model which strand of the daughter cell chromosome model to copy.


FIRST_STRAND

public static final int FIRST_STRAND

SECOND_STRAND

public static final int SECOND_STRAND
Constructor Detail

MeiosisChromosomeModel

public MeiosisChromosomeModel(MeiosisModel aMeiosisModel,
                              OrganismChromosome anOrganismChromosome,
                              int aMeiosisChromosomeModelType,
                              MeiosisChromosomeModel aPreviousMeiosisChromosomeModel,
                              int aPreviousMeiosisChromosomeModelStrand,
                              java.awt.Rectangle anEnclosingViewRectangle,
                              int aVisibleChromosomePairNumber,
                              java.awt.Color aColor)
Creates a new instance of MeiosisChromosomeModel with the given chromosome, meiosis model, type and previous chromosome model.

The previous chromosome model varies with the type. For an "original cell" chromosome model, the previous chromosome model is null as the original cell is first. For a "daughter cell" chromosome model, the previous chromosome model is the "original cell" chromosome model. For a "gamete" chromosome model, the previous chromosome model is the daughter cell.

The previous chromosome model is used to make sure that the transition from one state to the next across significant boundaries is smooth during meiosis animation. For example, when transitioning from the original cell to 2 daughter cells, the chromosome model(s) used changes from the single original cell chromosome model to the 2 daughter cell chromosome models. Ditto when going from daughter cell chromosome models to gamete chromosome models.

Parameters:
aMeiosisModel - MeiosisModel - the parent meiosis model, may not be null
anOrganismChromosome - OrganismChromosome - the organism chromosome upon which to base model, may not be null
aMeiosisChromosomeModelType - int - the type of this chromosome model (original, daughter, gamete, etc.)
aPreviousMeiosisChromosomeModel - MeiosisChromosomeModel - the previous chromosome model chronologically.
aPreviousMeiosisChromosomeModelStrand - int - the strand of previous chromosome model chronologically from which this model is formed (FIRST_STRAND, SECOND_STRAND, etc.)
anEnclosingViewRectangle - Rectangle - an enclosing rectangle for the chromosome's view
aChromosomeVisiblePairNumber - int - the number of the chromosome pair that this model is part of (e.g. 1) - zero if not visible
aColor - Color - the color of the chromosome
Throws:
java.lang.IllegalArgumentException - - illegal argument
Method Detail

delete

public void delete()
Delete this chromosome model. Assume the meiosis model is calling this method and therefore we don't need to notify it.

setMeiosisChromosomeModelType

public void setMeiosisChromosomeModelType(int newType)
Set chromosome model type. For now, it only works for daughter cells.
Parameters:
newType - int - new type of chromosome model

setPreviousMeiosisChromosomeModel

public void setPreviousMeiosisChromosomeModel(MeiosisChromosomeModel aPreviousMeiosisChromosomeModel)
Set the previous chromosome model of this chromosome model. Currently this only works for gamete chromosome models.

setEnclosingViewRectangle

public void setEnclosingViewRectangle(java.awt.Rectangle newEnclosingViewRectangle)
Set the enclosing rectangle for the view containing a display of this chromosome model. Note that this is not always the rectangle enclosing the cell displaying this chromosome. For example, during the latter parts of meiosis there are 2 or 4 "cells" being shown within the single enclosing view rectangle.

This method will adjust the locations of the chromosome model coordinates to scale properly when the view is resized by the user.

Parameters:
newEnlosingViewRectangle - Rectangle - an enclosing rectangle for this model's view

isVisible

public boolean isVisible()
Get whether this model is visible (true) or not visible (false).

getXTemporaryOffset

public int getXTemporaryOffset()
Get the X temporary offset of this chromosome.

Returns:
int - x temporary offset

getYTemporaryOffset

public int getYTemporaryOffset()
Get the Y temporary offset of this chromosome.

Returns:
int - y temporary offset

setTemporaryOffsets

public void setTemporaryOffsets(int anXTemporaryOffset,
                                int aYTemporaryOffset)
Set the temporary offsets of this chromosome.

Parameters:
anXTemporaryOffset - int - an X temporary offset
aYTemporaryOffset - int - a Y temporary offset

clearTemporaryOffsets

public void clearTemporaryOffsets()
Clear temporary offsets. A shortcut routine identical to calling setTemporaryOffsets(0,0).


getXCentromereAtStep

public int getXCentromereAtStep(int aStep)
Get the X centromere location as an int at the given meiosis step (NOT the array index!!).
Parameters:
aStep - int - step of meiosis (not array index!!)
Returns:
int - x location of centromere
Throws:
java.lang.IllegalArgumentException - - illegal step input

getYCentromereAtStep

public int getYCentromereAtStep(int aStep)
Get the Y centromere location as an int at the given meiosis step (NOT the array index!!).
Parameters:
aStep - int - step of meiosis (not array index!!)
Returns:
int - y location of centromere
Throws:
java.lang.IllegalArgumentException - - illegal step input

getAnglePStrandAtCentromereAtLastStep

public float getAnglePStrandAtCentromereAtLastStep()
Get the angle of the P strand of the chromosome at the centromere at the last step of this chromosome's portion of meiosis.
Returns:
float - angle of P strand of chromosome at centromere in radians at the last step of meiosis

getAngleQStrandAtCentromereAtLastStep

public float getAngleQStrandAtCentromereAtLastStep()
Get the angle of the Q strand of the chromosome at the centromere at the last step of this chromosome's portion of meiosis.
Returns:
float - angle of Q strand of chromosome at centromere in radians at the last step of meiosis

getXPStrandOnePoints

public int[] getXPStrandOnePoints(int aMeiosisStep)
Get the array of int's for x coordinates of P strand one at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for x coordinates of P strand one

getYPStrandOnePoints

public int[] getYPStrandOnePoints(int aMeiosisStep)
Get the array of int's for y coordinates of P strand one at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for y coordinates of P strand one

getXPStrandTwoPoints

public int[] getXPStrandTwoPoints(int aMeiosisStep)
Get the array of int's for x coordinates of P strand two at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for x coordinates of P strand two

getYPStrandTwoPoints

public int[] getYPStrandTwoPoints(int aMeiosisStep)
Get the array of int's for y coordinates of P strand two at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for y coordinates of P strand two

getXQStrandOnePoints

public int[] getXQStrandOnePoints(int aMeiosisStep)
Get the array of int's for x coordinates of Q strand one at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for x coordinates of Q strand one

getYQStrandOnePoints

public int[] getYQStrandOnePoints(int aMeiosisStep)
Get the array of int's for y coordinates of Q strand one at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for y coordinates of Q strand one

getXQStrandTwoPoints

public int[] getXQStrandTwoPoints(int aMeiosisStep)
Get the array of int's for x coordinates of Q strand two at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for x coordinates of Q strand two

getYQStrandTwoPoints

public int[] getYQStrandTwoPoints(int aMeiosisStep)
Get the array of int's for y coordinates of Q strand two at the given meiosis step.
Parameters:
aMeiosisStep - int - the meiosis step value (NOT the array index)
Returns:
int[] - array of int values for y coordinates of Q strand two

setAlleleAndColorVectors

public void setAlleleAndColorVectors(java.awt.Color aDefaultColor)
Set the vectors for the alleles and colors of this meiosis chromosome model. Use the default color only if you don't have another way of determining the color (e.g. using the previous chromosome model).

Note that calling this method after doing a crossing over on a daughter cell meiosis chromosome model will undo the crossing over changes. That may or may not be what you intended, so be careful.

Parameters:
aDefaultColor - Color - use this color if you have no other choice, must be specified for ORIG_CELL_CHROMOSOME chromosome models

setStrandAlleles

public void setStrandAlleles(int aStrand,
                             OrganismAllele[] alleles)
Set the array of Alleles for the given strand.

Parameters:
aStrand - int - the strand
OrganismAllele[] - - array of Organism Alleles along given strand of chromosome

getStrandAlleles

public OrganismAllele[] getStrandAlleles(int aStrand)
Get the array of Alleles for the given strand.

Parameters:
aStrand - int - the strand
Returns:
OrganismAllele[] - array of Organism Alleles along given strand of chromosome

getPStrandOneAlleles

public OrganismAllele[] getPStrandOneAlleles()
Get the array of organism alleles for P strand one. Elements are null if there is no organism allele at that position, non-null if there is an allele there.
Returns:
OrganismAllele[] - array of OrganismAllele values along P strand one of chromosome

setPStrandOneAlleles

public void setPStrandOneAlleles(OrganismAllele[] arr)

getPStrandTwoAlleles

public OrganismAllele[] getPStrandTwoAlleles()
Get the array of organism alleles for P strand two. Elements are null if there is no organism allele at that position, non-null if there is an allele there.
Returns:
OrganismAllele[] - array of OrganismAllele values along P strand two of chromosome

setPStrandTwoAlleles

public void setPStrandTwoAlleles(OrganismAllele[] arr)

getQStrandOneAlleles

public OrganismAllele[] getQStrandOneAlleles()
Get the array of organism alleles for Q strand one. Elements are null if there is no organism allele at that position, non-null if there is an allele there.
Returns:
OrganismAllele[] - array of OrganismAllele values along Q strand one of chromosome

setQStrandOneAlleles

public void setQStrandOneAlleles(OrganismAllele[] arr)

getQStrandTwoAlleles

public OrganismAllele[] getQStrandTwoAlleles()
Get the array of organism alleles for Q strand two. Elements are null if there is no organism allele at that position, non-null if there is an allele there.
Returns:
OrganismAllele[] - array of OrganismAllele values along Q strand two of chromosome

setQStrandTwoAlleles

public void setQStrandTwoAlleles(OrganismAllele[] arr)

setStrandColors

public void setStrandColors(int aStrand,
                            java.awt.Color[] colors)
Set the array of Colors for the given strand.

Parameters:
aStrand - int - the strand
Color[] - - array of Colors along given strand of chromosome

getStrandColors

public java.awt.Color[] getStrandColors(int aStrand)
Get the array of Colors for the given strand
Parameters:
aStrand - int - the strand
Returns:
Color[] - array of Colors along given strand of chromosome

getPStrandOneColors

public java.awt.Color[] getPStrandOneColors()
Get the array of Colors for P strand one.
Returns:
Color[] - array of Colors along P strand one of chromosome

setPStrandOneColors

public void setPStrandOneColors(java.awt.Color[] arr)

getPStrandTwoColors

public java.awt.Color[] getPStrandTwoColors()
Get the array of Colors for P strand two.
Returns:
Color[] - array of Colors along P strand two of chromosome

setPStrandTwoColors

public void setPStrandTwoColors(java.awt.Color[] arr)

getQStrandOneColors

public java.awt.Color[] getQStrandOneColors()
Get the array of Colors for Q strand one.
Returns:
Color[] - array of Colors along Q strand one of chromosome

setQStrandOneColors

public void setQStrandOneColors(java.awt.Color[] arr)

getQStrandTwoColors

public java.awt.Color[] getQStrandTwoColors()
Get the array of Colors for Q strand two.
Returns:
Color[] - array of Colors along Q strand two of chromosome

setQStrandTwoColors

public void setQStrandTwoColors(java.awt.Color[] arr)

getPreviousMeiosisChromosomeModel

public MeiosisChromosomeModel getPreviousMeiosisChromosomeModel()
Return the previous meiosis chromosome model.
Returns:
MeiosisChromosomeModel - the previous chromosome model for this model.

getChromosomeModelType

public int getChromosomeModelType()
Get the chromosome model type of this chromosome model
Returns:
int - chromosome model type

getNumberType

public int getNumberType()
Get the number/type of this chromosome model, zero if no chromosome.
Returns:
int - number/type

getChromosome

public OrganismChromosome getChromosome()
Get the chromosome for this model.
Returns:
OrganismChromosome - the chromosome from the parent for this model