org.concord.biologica.engine
Class Species

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--org.concord.biologica.engine.EngineObject
              |
              +--org.concord.biologica.engine.Species
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public final class Species
extends EngineObject
implements java.io.Serializable, java.beans.PropertyChangeListener

This class represents a species.

The ploidy number of a species may not be changed during the species' lifetime.

The name of a species may be changed, although be careful as no notification is done for this change - at least not yet.

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

Version:
$Revision: 1.1.1.1 $ $Date: 2001/04/28 00:39:14 $
Author:
$Author: ed $
See Also:
EngineProp.DELETED, EngineProp.DESCRIPTION, EngineProp.DIPLOID_TYPE, EngineProp.ID, EngineProp.GENOTYPE_TO_PHENOTYPE_RULE_ADDED, EngineProp.GENOTYPE_TO_PHENOTYPE_RULE_MOVED, EngineProp.GENOTYPE_TO_PHENOTYPE_RULE_REMOVED, EngineProp.LOCKED_STATE, EngineProp.NAME, EngineProp.SPECIES_CHROMOSOME_ADDED, EngineProp.SPECIES_CHROMOSOME_REMOVED, EngineProp.SPECIES_IMAGE_ADDED, EngineProp.SPECIES_IMAGE_REMOVED, EngineProp.TRAIT_ADDED, EngineProp.TRAIT_REMOVED, EngineProp.XXSMALL_IMAGE_COLUMN_WIDTH, EngineProp.XXSMALL_IMAGE_ROW_HEIGHT, EngineProp.XSMALL_IMAGE_COLUMN_WIDTH, EngineProp.XSMALL_IMAGE_ROW_HEIGHT, EngineProp.SMALL_IMAGE_COLUMN_WIDTH, EngineProp.SMALL_IMAGE_ROW_HEIGHT, EngineProp.MEDIUM_IMAGE_COLUMN_WIDTH, EngineProp.MEDIUM_IMAGE_ROW_HEIGHT, EngineProp.LARGE_IMAGE_COLUMN_WIDTH, EngineProp.LARGE_IMAGE_ROW_HEIGHT, EngineProp.XLARGE_IMAGE_COLUMN_WIDTH, EngineProp.XLARGE_IMAGE_ROW_HEIGHT, PropertyChangeListener, Serialized Form

Field Summary
static int DIPLOID_TYPE_NO_SEX_CHROMOSOMES
          Third type of diploid species - no sex chromosomes (e.g.
static java.lang.String DIPLOID_TYPE_NO_SEX_CHROMOSOMES_STRING
           
static int DIPLOID_TYPE_XX_FEMALE_XY_MALE
          One type of diploid species - XX female, XY male (e.g.
static java.lang.String DIPLOID_TYPE_XX_FEMALE_XY_MALE_STRING
           
static int DIPLOID_TYPE_XY_FEMALE_XX_MALE
          Second type of diploid species - XY female, XX male (e.g.
static java.lang.String DIPLOID_TYPE_XY_FEMALE_XX_MALE_STRING
           
static int FEMALE_AND_MALE
          Gender values used in defining genotype to phenotype rules, species image columns and species image rows.
static java.lang.String FEMALE_AND_MALE_STRING
           
static int FEMALE_ONLY
           
static java.lang.String FEMALE_ONLY_STRING
           
static int MALE_ONLY
           
static java.lang.String MALE_ONLY_STRING
           
 
Fields inherited from class org.concord.biologica.engine.EngineObject
AUTOMATIC_LOCKED, AUTOMATIC_LOCKED_STRING, changes, deleted, FALSE, id, lockedState, MANUAL_AND_AUTOMATIC_LOCKED, MANUAL_AND_AUTOMATIC_LOCKED_STRING, MANUAL_LOCKED, MANUAL_LOCKED_STRING, NULL_ID, TRUE, UNLOCKED, UNLOCKED_STRING, xmlElementContext
 
Constructor Summary
Species(World aWorld, java.io.File aFile)
          Creates a new species given a world and a species file.
Species(World aWorld, int aPloidyNumber, java.lang.String aName)
          Creates a new species given a world, ploidy number and name.
Species(World aWorld, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
          Create a new species and start handling XML parsing events to set the properties of this object.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
 void delete()
          Delete this object, notifying parent objects and deleting any child objects.
 void delete(boolean notifyChange)
           
 void endElement(java.lang.String anElementName)
          Handle notification that the parsing of the given element has ended.
 void exportTo(java.io.File aFile)
          Export this species to a species file.
 java.util.Vector getCharacteristicsVector()
          Returns a vector of the Characteristics in this species.
 java.lang.String getDescription()
          Return the description of this species.
 int getDiploidType()
          Returns diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.
 java.lang.String getDiploidTypeAsString()
          Returns diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.
 Gene getGene(java.lang.String aGeneName)
          Returns the gene of this species with the given name.
 java.util.Enumeration getGenotypeToPhenotypeRules()
          Returns an enumeration over the vector of genotype to phenotype rules in this species.
 int getImageColumnWidth(int imageSize)
          Returns image column width of this species.
 int getImageRowHeight(int imageSize)
          Returns image row height of this species.
 int getIndexOfGenotypeToPhenotypeRule(GenotypeToPhenotypeRule aRule)
          Get index of the given genotype to phenotype rule in this species
 java.lang.String getName()
          Return the name of this species.
 java.util.Enumeration getNonSexChromosomes()
          Returns an enumeration over the vector of non-sex chromosomes in this species.
 int getNumberOfChromosomes()
          Return the number of sex and non-sex chromosomes in this species.
 int getNumberOfGenes()
          Return the number of genes in this species.
 int getNumberOfGenotypeToPhenotypeRules()
          Return the number of genotype to phenotype rules in this species.
 int getNumberOfNonSexChromosomes()
          Return the number of non-sex chromosomes in this species.
 int getNumberOfSexChromosomes()
          Return the number of sex chromosomes in this species.
 int getNumberOfSpeciesImages()
          Get the number of species images for this species.
 int getNumberOfTraits()
          Return the number of traits in this species.
 int getPloidyNumber()
          Returns ploidy number of this species, which may either be 1 (haploid), 2 (diploid) or 3 (haploid and diploid - e.g.
 java.util.Enumeration getSexChromosomes()
          Returns an enumeration over the vector of sex chromosomes in this species.
 java.util.Vector getSpeciesAllelesVector()
          Returns a vector of the SpeciesAlleles in this species.
 java.util.Enumeration getSpeciesImages()
          Returns an enumeration over the vector of species images in this species.
 java.util.Enumeration getTraits()
          Returns an enumeration over the vector of traits in this species.
 World getWorld()
          Return the world containing this species.
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable white space character data.
 void moveGenotypeToPhenotypeRuleAfter(GenotypeToPhenotypeRule aRuleToMove, GenotypeToPhenotypeRule aRuleAfter)
          Move the given genotype to phenotype rule immediately after the second rule.
 void moveGenotypeToPhenotypeRuleDown(GenotypeToPhenotypeRule aRule)
          Move the given genotype to phenotype rule down one position in the list of rules for this species.
 void moveGenotypeToPhenotypeRuleUp(GenotypeToPhenotypeRule aRule)
          Move the given genotype to phenotype rule up one position in the list of rules for this species.
 java.util.Vector parseAlleleString(int sex, java.lang.String allelesString)
          Parse an allele string to create a ChromosomeSpecification
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle property change events
 void setAutomaticLocked(boolean automaticLocked)
          Set or unset the automatic locked state of this object, leaving other components of the locked state untouched.
 void setDescription(java.lang.String aDescription)
          Set the description of this species.
 void setDiploidType(int aDiploidType)
          Set the diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.
 void setDiploidTypeAsString(java.lang.String aDiploidTypeString)
          Set the diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.
 void setImageColumnWidth(int imageSize, int anImageColumnWidth)
          Set the image column width of a particular image size for this species.
 void setImageRowHeight(int imageSize, int anImageRowHeight)
          Set the image row height of a particular image size for this species.
 void setLockedState(int aLockedState)
          Set the lock state of the object, recursively setting the lock state of children objects.
 void setManualLocked(boolean manualLocked)
          Set or unset the manual locked state of this object, leaving other components of the locked state untouched.
 void setName(java.lang.String aName)
          Set the name of this species.
 void setPloidyNumber(int newPloidyNumber)
          Set the ploidy number, which must be 1 or 2.
 void startElement(java.lang.String anElementName, org.xml.sax.AttributeList amap)
          Handle notification that the parser has hit the start of a new element with the given name and attributes.
 java.lang.String toString()
          Return a string representation of this object, usually the object's name.
 void writeToStream(java.io.PrintWriter stream)
          Writes this object to the given stream in XML format.
 
Methods inherited from class org.concord.biologica.engine.EngineObject
addPropertyChangeListener, getID, getLockedState, getLockedStateAsString, isAutomaticLocked, isDeleted, isLocked, isManualLocked, notifySelected, release, removePropertyChangeListener, setID, setLockedStateAsString
 
Methods inherited from class org.xml.sax.HandlerBase
endDocument, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIPLOID_TYPE_XX_FEMALE_XY_MALE

public static final int DIPLOID_TYPE_XX_FEMALE_XY_MALE
One type of diploid species - XX female, XY male (e.g. humans)

DIPLOID_TYPE_XX_FEMALE_XY_MALE_STRING

public static final java.lang.String DIPLOID_TYPE_XX_FEMALE_XY_MALE_STRING

DIPLOID_TYPE_XY_FEMALE_XX_MALE

public static final int DIPLOID_TYPE_XY_FEMALE_XX_MALE
Second type of diploid species - XY female, XX male (e.g. dragons)

DIPLOID_TYPE_XY_FEMALE_XX_MALE_STRING

public static final java.lang.String DIPLOID_TYPE_XY_FEMALE_XX_MALE_STRING

DIPLOID_TYPE_NO_SEX_CHROMOSOMES

public static final int DIPLOID_TYPE_NO_SEX_CHROMOSOMES
Third type of diploid species - no sex chromosomes (e.g. plants)

DIPLOID_TYPE_NO_SEX_CHROMOSOMES_STRING

public static final java.lang.String DIPLOID_TYPE_NO_SEX_CHROMOSOMES_STRING

FEMALE_AND_MALE

public static final int FEMALE_AND_MALE
Gender values used in defining genotype to phenotype rules, species image columns and species image rows.

FEMALE_AND_MALE_STRING

public static final java.lang.String FEMALE_AND_MALE_STRING

FEMALE_ONLY

public static final int FEMALE_ONLY

FEMALE_ONLY_STRING

public static final java.lang.String FEMALE_ONLY_STRING

MALE_ONLY

public static final int MALE_ONLY

MALE_ONLY_STRING

public static final java.lang.String MALE_ONLY_STRING
Constructor Detail

Species

public Species(World aWorld,
               int aPloidyNumber,
               java.lang.String aName)
Creates a new species given a world, ploidy number and name.

A species is initially created with no genes. Genes can be added by creating genes and specifying the species in the gene.

Parameters:
aWorld - World - a world containing this species
aPloidyNumber - int - ploidy number, must be 1 or 2
aName - String - name of this organism, may not be null
anImageColumnWidth - int - width of image columns, must be >= 0
anImageRowHeight - int - height of image rows, must be >= 0
Throws:
java.lang.IllegalArgumentException - - input argument(s) illegal

Species

public Species(World aWorld,
               java.io.File aFile)
Creates a new species given a world and a species file.

Parameters:
aWorld - World - a world containing this species
aFile - File - a species file
Throws:
java.lang.IllegalArgumentException - - input argument(s) illegal

Species

public Species(World aWorld,
               java.lang.String anElementName,
               int anElementID,
               com.sun.xml.parser.Parser anXMLParser,
               ImportContext importContext)
Create a new species and start handling XML parsing events to set the properties of this object.

Parameters:
aWorld - World - the enclosing world for this new species
anElementName - String - the element name
anElementID - int - the element id
anXMLParser - com.sun.xml.parser.Parser - the element parser
importContext - ImportContext - import context for mapping ids from file to this world
Throws:
java.lang.IllegalArgumentException - - input arguments illegal
Method Detail

startElement

public void startElement(java.lang.String anElementName,
                         org.xml.sax.AttributeList amap)
                  throws org.xml.sax.SAXException
Handle notification that the parser has hit the start of a new element with the given name and attributes.

For internal elements (elements that are non-EngineObject instance variables of this object), call xmlElementContext.startElement() and xmlElementContext will receive the remaining element notifications. For external elements (elements that are EngineObject instance variables of this object), create an object of the appropriate class and that object will receive the remaining element notifications.

Overrides:
startElement in class org.xml.sax.HandlerBase
Parameters:
anElementName - String - name of element
amap - AttributeList - an attribute list

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data.
Overrides:
characters in class org.xml.sax.HandlerBase
Parameters:
ch - char[] - characters
start - int - start of string
length - int - length of string

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Receive notification of ignorable white space character data.
Overrides:
ignorableWhitespace in class org.xml.sax.HandlerBase
Parameters:
ch - char[] - characters
start - int - start of string
length - int - length of string

endElement

public void endElement(java.lang.String anElementName)
                throws org.xml.sax.SAXException
Handle notification that the parsing of the given element has ended.
Overrides:
endElement in class org.xml.sax.HandlerBase
Parameters:
anElementName - String - the element name

parseAlleleString

public java.util.Vector parseAlleleString(int sex,
                                          java.lang.String allelesString)
Parse an allele string to create a ChromosomeSpecification

The allele string contains sequences like "a:H,b:h,b:W" where the "a" or "b" on the left side of the colon specifies which of the chromosome pair is affected and the string on the right side of the colon specifies the allele. Spaces are significant in allele names, so there should be no spaces anywhere in the specification string except for in the name, if necessary.

For sex chromosomes, the "a" and "b" on the left sides of the colon are significant only when there are 2 X chromosomes. Otherwise "a" must be used for both X and Y chromosome alleles. "b" will be ignored if there is only one X and one Y chromosome.

Finally, when there are X and Y chromosomes, the chromosome that is created first is always random and cannot be specified.

Parameters:
sex - int - specifies sex, overrides string if inconsistent
allelesString - String - string specification of the alleles
Throws:
java.lang.IllegalArgumentException - - input argument(s) illegal

delete

public void delete()
Delete this object, notifying parent objects and deleting any child objects.

When this method is called, a property change event is generated for the property named EngineProp.DELETED.

Overrides:
delete in class EngineObject
Throws:
ObjectLockedException - - object is locked and cannot be deleted

delete

public void delete(boolean notifyChange)

exportTo

public void exportTo(java.io.File aFile)
Export this species to a species file.
Parameters:
aFile - File - a species file

toString

public java.lang.String toString()
Return a string representation of this object, usually the object's name.

Overrides:
toString in class EngineObject
Returns:
String - string representation of object

setAutomaticLocked

public void setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. Recursively sets the automatic locked state of children of this object.

When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.

Overrides:
setAutomaticLocked in class EngineObject
Parameters:
automaticLocked - boolean - object should be automatic locked (true) or not (false)

setManualLocked

public void setManualLocked(boolean manualLocked)
Set or unset the manual locked state of this object, leaving other components of the locked state untouched. Recursively sets the manual locked state of children of this object.

When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.

Overrides:
setManualLocked in class EngineObject
Parameters:
manualLocked - boolean - object should be manually locked (true) or not (false)

setLockedState

public void setLockedState(int aLockedState)
Set the lock state of the object, recursively setting the lock state of children objects.

When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.

Overrides:
setLockedState in class EngineObject
Parameters:
aLockedState - int - new locked state of this object
Throws:
java.lang.IllegalArgumentException - - new locked state invalid

getPloidyNumber

public int getPloidyNumber()
Returns ploidy number of this species, which may either be 1 (haploid), 2 (diploid) or 3 (haploid and diploid - e.g. yeast).

Returns:
ploidyNumber - integer ploidy number of this organism (1, 2 or 3)

setPloidyNumber

public void setPloidyNumber(int newPloidyNumber)
Set the ploidy number, which must be 1 or 2.

Once a species has chromosomes, its ploidy number may not be changed.

Parameters:
newPloidyNumber - int - new ploidy number (1 or 2)
Throws:
InternalEngineException - - ploidy number illegal or species ploidy cannot be changed
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be deleted

getDiploidType

public int getDiploidType()
Returns diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.

Returns:
diploidType - integer indicating diploid type of this species

getDiploidTypeAsString

public final java.lang.String getDiploidTypeAsString()
Returns diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.

Returns:
diploidType - String

setDiploidType

public void setDiploidType(int aDiploidType)
Set the diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.

Parameters:
aDiploidType - int - new diploid type
Throws:
InternalEngineException - - diploid type illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be deleted

setDiploidTypeAsString

public void setDiploidTypeAsString(java.lang.String aDiploidTypeString)
Set the diploid type of this species, which may either be DIPLOID_TYPE_XX_FEMALE_XY_MALE, DIPLOID_TYPE_XY_FEMALE_XX_MALE or DIPLOID_TYPE_NO_SEX_CHROMOSOMES.

Parameters:
aDiploidTypeString - String - new diploid type as a string
Throws:
InternalEngineException - - diploid type illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be deleted

getImageColumnWidth

public int getImageColumnWidth(int imageSize)
Returns image column width of this species.
Parameters:
imageSize - int - image size (e.g. SMALL_IMAGE_SIZE, etc.)
Returns:
integer value - the image column width of this species

setImageColumnWidth

public void setImageColumnWidth(int imageSize,
                                int anImageColumnWidth)
Set the image column width of a particular image size for this species.
Parameters:
imageSize - - the image size being set (e.g. SpeciesImage.XSMALL_IMAGE_SIZE)
anImageColumnWidth - int - the new image column width of species, must be >= 0
Throws:
InternalEngineException - - diploid type illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be deleted

getImageRowHeight

public int getImageRowHeight(int imageSize)
Returns image row height of this species.
Parameters:
imageSize - int - image size (e.g. SMALL_IMAGE_SIZE, etc.)
Returns:
integer value - the image row height of this species

setImageRowHeight

public void setImageRowHeight(int imageSize,
                              int anImageRowHeight)
Set the image row height of a particular image size for this species.
Parameters:
imageSize - - the image size being set (e.g. XSMALL_IMAGE_SIZE)
anImageRowHeight - int - the new image row height of species, must be >= 0
Throws:
InternalEngineException - - diploid type illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be deleted

getWorld

public World getWorld()
Return the world containing this species. May not be null.

Overrides:
getWorld in class EngineObject
Returns:
World - the world containing this species, may not be null

getName

public java.lang.String getName()
Return the name of this species. May be null.

Returns:
String - name of this species, may not be null.

setName

public void setName(java.lang.String aName)
Set the name of this species.

When this method is successful, a property change event is fired for the property named EngineProp.NAME.

Parameters:
aName - String - the new name of this species, may not be null
Throws:
java.lang.IllegalArgumentException - - input argument illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be modified

getDescription

public java.lang.String getDescription()
Return the description of this species. May be null.

Returns:
String - description of this species, may not be null.

setDescription

public void setDescription(java.lang.String aDescription)
Set the description of this species.

When this method is successful, a property change event is fired for the property named EngineProp.DESCRIPTION.

Parameters:
aDescription - String - the new description of this species, may not be null
Throws:
java.lang.IllegalArgumentException - - input argument illegal
ObjectDeletedException - - object is deleted and cannot be modified
ObjectLockedException - - object is locked and cannot be modified

getNonSexChromosomes

public java.util.Enumeration getNonSexChromosomes()
Returns an enumeration over the vector of non-sex chromosomes in this species.

The vector of non-sex chromosomes is cloned and the enumeration is created for the clone, so it is safe to modify the vector of chromosomes (by creating new ones, moving them around, etc.) while using this returned enumeration.

Returns:
Enumeration - an enumeration over the non-sex chromosomes in this species

getNumberOfNonSexChromosomes

public int getNumberOfNonSexChromosomes()
Return the number of non-sex chromosomes in this species.

Returns:
int - the number of non-sex chromosomes in this species

getSexChromosomes

public java.util.Enumeration getSexChromosomes()
Returns an enumeration over the vector of sex chromosomes in this species.

Returns:
Enumeration - an enumeration over the sex chromosomes in this species

getNumberOfSexChromosomes

public int getNumberOfSexChromosomes()
Return the number of sex chromosomes in this species.

Returns:
int - the number of sex chromosomes in this species

getNumberOfChromosomes

public int getNumberOfChromosomes()
Return the number of sex and non-sex chromosomes in this species.

Returns:
int - the number of sex and non-sex chromosomes in this species

getGene

public Gene getGene(java.lang.String aGeneName)
Returns the gene of this species with the given name.
Parameters:
aGeneName - String - the name of the gene to find, if null then this method returns null
Returns:
Gene - the gene with the given name, null if gene not found or aGeneName is null

getTraits

public java.util.Enumeration getTraits()
Returns an enumeration over the vector of traits in this species.

The vector of traits is cloned and the enumeration is created for the clone, so it is safe to modify the vector of traits (by creating new ones, moving them around, etc.) while using this returned enumeration.

Returns:
Enumeration - an enumeration over the traits in this species

getNumberOfTraits

public int getNumberOfTraits()
Return the number of traits in this species.

Returns:
int - the number of traits in this species

moveGenotypeToPhenotypeRuleAfter

public void moveGenotypeToPhenotypeRuleAfter(GenotypeToPhenotypeRule aRuleToMove,
                                             GenotypeToPhenotypeRule aRuleAfter)
Move the given genotype to phenotype rule immediately after the second rule.

Parameters:
aRuleToMove - GenotypeToPhenotypeRule - the rule to move
aRuleAfter - GenotypeToPhenotypeRule - the rule to move the first rule immediately after
Throws:
java.lang.IllegalArgumentException - - input rule null

moveGenotypeToPhenotypeRuleUp

public void moveGenotypeToPhenotypeRuleUp(GenotypeToPhenotypeRule aRule)
Move the given genotype to phenotype rule up one position in the list of rules for this species. Do nothing if the rule is already the first one.

Parameters:
aRule - GenotypeToPhenotypeRule - the rule to move up one
Throws:
java.lang.IllegalArgumentException - - input rule null

moveGenotypeToPhenotypeRuleDown

public void moveGenotypeToPhenotypeRuleDown(GenotypeToPhenotypeRule aRule)
Move the given genotype to phenotype rule down one position in the list of rules for this species. Do nothing if the rule is already the last one.

Parameters:
aRule - GenotypeToPhenotypeRule - the rule to move down one
Throws:
java.lang.IllegalArgumentException - - input rule null

getIndexOfGenotypeToPhenotypeRule

public int getIndexOfGenotypeToPhenotypeRule(GenotypeToPhenotypeRule aRule)
Get index of the given genotype to phenotype rule in this species
Parameters:
aRule - GenotypeToPhenotypeRule - the given genotype to phenotype rule
Returns:
int - index of the given rule in the rules of this species, zero-based
Throws:
java.lang.IllegalArgumentException - - input rule null

getGenotypeToPhenotypeRules

public java.util.Enumeration getGenotypeToPhenotypeRules()
Returns an enumeration over the vector of genotype to phenotype rules in this species.

The vector of rules is cloned and the enumeration is created for the clone, so it is safe to modify the vector of rules (by creating new ones, moving them around, etc.) while using this returned enumeration.

Returns:
Enumeration - an enumeration over the genotype to phenotype rules in this species

getNumberOfGenotypeToPhenotypeRules

public int getNumberOfGenotypeToPhenotypeRules()
Return the number of genotype to phenotype rules in this species.

Returns:
int - the number of genotype to phenotype rules in this species

getSpeciesImages

public java.util.Enumeration getSpeciesImages()
Returns an enumeration over the vector of species images in this species.

Returns:
Enumeration - an enumeration over the species images in this species

getNumberOfSpeciesImages

public int getNumberOfSpeciesImages()
Get the number of species images for this species.

Returns:
int - the number of species images

getNumberOfGenes

public int getNumberOfGenes()
Return the number of genes in this species.

This is a convenience routine, as the genes are actually not stored directly in the species, but instead off of their chromosomes. So all this method does is walk through the chromosomes adding up their genes to arrive at a total count.

Returns:
int - the number of genes in this species

getCharacteristicsVector

public java.util.Vector getCharacteristicsVector()
Returns a vector of the Characteristics in this species.

This is a convenience routine, as anyone could also create this vector themselves by getting all the traits in this species and then asking each trait for its characteristics, etc.

Returns:
Enumeration - an enumeration over the traits in this species

getSpeciesAllelesVector

public java.util.Vector getSpeciesAllelesVector()
Returns a vector of the SpeciesAlleles in this species.

This is a convenience routine, as anyone could also create this vector themselves by getting all the Chromosomes, Genes and then Alleles in this species, etc.

Returns:
Enumeration - an enumeration over the species alleles in this species

writeToStream

public void writeToStream(java.io.PrintWriter stream)
                   throws java.io.IOException
Writes this object to the given stream in XML format. Usually this method is used to write the object to a file for saving it, but that is potentially not the only use.

We could supply a default implementation that knows how to write the id value. But that convenience is not chosen because it's never correct to use just this implementation of these methods, so I'd rather have a compilation fail if a derived class fails to implement this method.

The inverse of this method is a constructor that takes a org.xml.sax.Parser argument and other arguments.

Overrides:
writeToStream in class EngineObject
Parameters:
stream - PrintWriter - print stream
Throws:
java.lang.IllegalArgumentException - - input arguments illegal
java.io.IOException - - an IO error occurred in java libraries

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