org.concord.biologica.ui
Class FertilizationModel

java.lang.Object
  |
  +--org.concord.biologica.ui.FertilizationModel
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public final class FertilizationModel
extends java.lang.Object
implements java.beans.PropertyChangeListener

FertilizationModel contains the data describing the fertilization process state for the fertilization of 2 gametes to form a single offspring organism. It does not contain the code for drawing the animation as that is in the view objects that show fertilization.

This model and its associated chromosome models 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.

An object of this class will generate the following property change events:

Version:
$Revision: 1.2 $ $Date: 2002/03/29 15:13:41 $
Author:
$Author: qliao $
See Also:
UIProp.FERTILIZATION_GAMETES, UIProp.FERTILIZATION_OFFSPRING_ORGANISM, UIProp.FERTILIZATION_STARTED, UIProp.FERTILIZATION_STEP, PropertyChangeListener

Field Summary
protected  java.beans.PropertyChangeSupport changes
          Utility object which manages property change events and listeners.
 
Constructor Summary
FertilizationModel()
          Creates an empty instance of FertilizationModel
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
          Add a property change listener for properties.
 int decrementStep()
          Decrement the current step of the fertilization, returning the new current step value.
 void delete()
          Deletes this model and associated models
 java.util.Vector getCellBoundaries()
          Get CellArc and CellLine enumeration to use when drawing boundaries and spindles of cell(s).
 java.util.Vector getChromosomeModelEnumerations()
          Get vector of the appropriate enumerations of chromosome models in this fertilization model.
 Organism getOffspringOrganism()
           
 int getStep()
          Get the current step of the fertilization
 int incrementStep()
          Increment the current step of the fertilization
 boolean isValidToDoFertilization()
           
 void onFatherGameteChanged()
          React to the father selected gamete changing
 void onMotherGameteChanged()
          React to the mother selected gamete changing
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle property change events
 void removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
          Remove a property change listener for properties.
 void setEnclosingViewRectangle(java.awt.Rectangle aRectangle)
          Set the rectangle within which the fertilization model must confine itself and its chromosomes.
 void setMeiosisModels(MeiosisModel aMotherMeiosisModel, MeiosisModel aFatherMeiosisModel)
          Set the meiosis models of this fertilization model, deleting any existing state for other meiosis models.
 int setStep(int aStep)
          Set the current step of the fertilization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changes

protected transient java.beans.PropertyChangeSupport changes
Utility object which manages property change events and listeners.
Constructor Detail

FertilizationModel

public FertilizationModel()
Creates an empty instance of FertilizationModel
Method Detail

delete

public void delete()
Deletes this model and associated models

setMeiosisModels

public void setMeiosisModels(MeiosisModel aMotherMeiosisModel,
                             MeiosisModel aFatherMeiosisModel)
Set the meiosis models of this fertilization model, deleting any existing state for other meiosis models.

Parameters:
aMotherMeiosisModel - MeiosisModel - the mother meiosis model
aFatherMeiosisModel - MeiosisModel - the father meiosis model

onMotherGameteChanged

public void onMotherGameteChanged()
React to the mother selected gamete changing

onFatherGameteChanged

public void onFatherGameteChanged()
React to the father selected gamete changing

decrementStep

public int decrementStep()
Decrement the current step of the fertilization, returning the new current step value.
Returns:
int - new current step value of fertilization

incrementStep

public int incrementStep()
Increment the current step of the fertilization
Returns:
int - new current step value of fertilization

getStep

public int getStep()
Get the current step of the fertilization
Returns:
int - new current step

setStep

public int setStep(int aStep)
Set the current step of the fertilization
Parameters:
aStep - int - new proposed current step
Returns:
int - new current step

getChromosomeModelEnumerations

public java.util.Vector getChromosomeModelEnumerations()
Get vector of the appropriate enumerations of chromosome models in this fertilization model.

In all cases, a Vector holding 2 Enumerations will be returned. The first Enumeration will be over the chromosome models from the mother and the second Enumeration will be over the chromosome models from the father.

Returns:
Enumeration - an enumeration over all chromosomes models in this meiosis model

getCellBoundaries

public java.util.Vector getCellBoundaries()
Get CellArc and CellLine enumeration to use when drawing boundaries and spindles of cell(s).

Returns:
Vector of CellArc and CellLine objects.

setEnclosingViewRectangle

public void setEnclosingViewRectangle(java.awt.Rectangle aRectangle)
Set the rectangle within which the fertilization model must confine itself and its chromosomes. Buttons should be outside of this area whenever possible. This method should be called when the enclosing view is resized, giving the model data a chance to scale itself appropriately.
Parameters:
aRectangle - Rectangle - the enclosing rectangle

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
Add a property change listener for properties.
Parameters:
aListener - PropertyChangeListener - a new listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
Remove a property change listener for properties.
Parameters:
aListener - PropertyChangeListener - a listener to remove

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - PropertyChangeEvent - the property change event

getOffspringOrganism

public Organism getOffspringOrganism()

isValidToDoFertilization

public boolean isValidToDoFertilization()