|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.HandlerBase | +--org.concord.biologica.engine.EngineObject | +--org.concord.biologica.engine.OrganismChromosome
This class represents an organism chromosome - a chromosome which has a length and some organism alleles.
An instance of this class is contained by one organism.
An instance of this class may or may not be part of a diploid chromosome set and therefore may or may not have a homologous chromosome.
An object of this class will generate the following property change events:
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.IMAGE_NUMBER
,
EngineProp.LOCKED_STATE
,
EngineProp.NUMBER_TYPE
,
EngineProp.ORGANISM_ALLELE_ADDED
,
EngineProp.ORGANISM_ALLELE_REMOVED
,
PropertyChangeListener
, Serialized FormFields 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 | |
OrganismChromosome(Organism anOrganism,
ChromosomeSpecification aChromosomeSpecification)
Create a new organism chromosome from a chromosome specification, choosing alleles based on the chromosome specification. |
|
OrganismChromosome(Organism anOrganism,
OrganismChromosome anOrganismChromosome)
Create a new organism chromosome with another organism chromosome as a model. |
|
OrganismChromosome(Organism anOrganism,
SpeciesChromosome aSpeciesChromosome)
Create a new organism chromosome from a species chromosome, randomly choosing alleles from the genes of the species chromosome. |
|
OrganismChromosome(Organism anOrganism,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new organism chromosome 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. |
byte |
getBase(int index)
Returns the base value at the given index in this chromosome. |
int |
getChromosomeType()
Get the chromosome type (autosome or sex chromosome). |
int |
getChromosomeViewHeight()
|
int |
getImageNumber()
Returns the image number of this chromosome. |
int |
getLengthInBases()
Returns the length of the chromosome in bases. |
int |
getLengthInCodons()
Returns the length of the chromosome in codons. |
int |
getNumberOfOrganismAlleles()
Return the number of organism alleles of this chromosome. |
int |
getNumberType()
Returns the number or type of this chromosome. |
java.lang.String |
getNumberTypeAsString()
Returns the number / type of this chromosome. |
Organism |
getOrganism()
Returns the organism chromosome's organism. |
java.util.Enumeration |
getOrganismAlleles()
Returns an enumeration over the chromosome's organism alleles. |
OrganismAllele[] |
getPStrand()
|
java.awt.Color[] |
getPStrandColor()
|
OrganismAllele[] |
getQStrand()
|
java.awt.Color[] |
getQStrandColor()
|
Species |
getSpecies()
Returns the organism chromosome's species. |
SpeciesChromosome |
getSpeciesChromosome()
Get the species chromosome for ths organism chromosome. |
World |
getWorld()
Get the world containing this object. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
boolean |
isSexChromosome()
Returns whether the chromosome is a sex chromosome. |
boolean |
isVisible()
Get the visibility of this chromosome. |
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setChromosomeBranchs(OrganismAllele[] P_Strand,
java.awt.Color[] P_Strand_Color,
OrganismAllele[] Q_Strand,
java.awt.Color[] Q_Strand_Color)
This method is used to remember the paint information for this chromosome, Special for drawing the new chromosome for the crossing over offspring. |
void |
setChromosomeViewHeight(int h)
|
void |
setImageNumber(int anImageNumber)
Sets the image number of this chromosome. |
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 |
setNumberType(int aNumberType)
Sets the number or type of this chromosome. |
void |
setNumberTypeAsString(java.lang.String aNumberTypeString)
Sets the number or type of this chromosome, using a string as input. |
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 |
Constructor Detail |
public OrganismChromosome(Organism anOrganism, SpeciesChromosome aSpeciesChromosome)
It's expected that this method will be used to create organisms from a species definition (e.g. out of thin air), as in when creating a first set of organisms at the start of editing session.
anOrganism
- Organism - containing organism, may not be nullaSpeciesChromosome
- SpeciesChromosome - a species chromosome to use as a model, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic OrganismChromosome(Organism anOrganism, ChromosomeSpecification aChromosomeSpecification)
It's expected that this method will be used to create organism chromosomes produced by an explicit meiosis / fertilization process.
anOrganism
- Organism - containing organism, may not be nullaChromosomeSpecification
- ChromosomeSpecification - a chromosome specification to use, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic OrganismChromosome(Organism anOrganism, OrganismChromosome anOrganismChromosome)
This constructor is useful when creating an organism from another organism, as when a child is formed from the genotypes of its parents. See the Organism constructor that takes 2 parent organisms for an example of how this constructor is used.
anOrganism
- Organism - containing organism, may not be nullanOrganismChromosome
- OrganismChromosome - an organism chromosome to use as a model, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic OrganismChromosome(Organism anOrganism, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
anOrganism
- Organism - the enclosing organism for this new organism chromosomeanElementName
- String - the element nameanElementID
- int - the element idanXMLParser
- com.sun.xml.parser.Parser - the element parserimportContext
- ImportContext - import context for mapping ids from file to this worldjava.lang.IllegalArgumentException
- - input arguments illegalMethod Detail |
public void startElement(java.lang.String anElementName, org.xml.sax.AttributeList amap) throws org.xml.sax.SAXException
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.
startElement
in class org.xml.sax.HandlerBase
anElementName
- String - name of elementamap
- AttributeList - an attribute listpublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void endElement(java.lang.String anElementName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.HandlerBase
anElementName
- String - the element namepublic void delete()
When this method is called, a property change event is generated for the property named EngineProp.DELETED.
delete
in class EngineObject
public void delete(boolean notifyChange)
public SpeciesChromosome getSpeciesChromosome()
public boolean isVisible()
public void setAutomaticLocked(boolean automaticLocked)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setAutomaticLocked
in class EngineObject
automaticLocked
- boolean - object should be automatic locked (true) or not (false)public void setManualLocked(boolean manualLocked)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setManualLocked
in class EngineObject
manualLocked
- boolean - object should be manually locked (true) or not (false)public void setLockedState(int aLockedState)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
setLockedState
in class EngineObject
aLockedState
- int - new locked state of this objectjava.lang.IllegalArgumentException
- - new locked state invalidpublic java.lang.String toString()
toString
in class EngineObject
public Organism getOrganism()
public Species getSpecies()
public World getWorld()
getWorld
in class EngineObject
public int getLengthInBases()
public int getLengthInCodons()
public byte getBase(int index)
index
- int - index into chromosome, must be 0 to length of chromosome-1java.lang.IllegalArgumentException
- - input argument(s) illegalBase.getPairBase(byte, int)
public int getNumberType()
public java.lang.String getNumberTypeAsString()
public void setNumberType(int aNumberType)
aNumberType
- int - new number or type of chromosomepublic void setNumberTypeAsString(java.lang.String aNumberTypeString)
aNumberTypeString
- String - new number or type of chromosome as a stringObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic int getImageNumber()
SpeciesChromosome.LONGEST_CHROMOSOME_IMAGE
,
SpeciesChromosome.LONGER_CHROMOSOME_IMAGE
,
SpeciesChromosome.LONG_CHROMOSOME_IMAGE
,
SpeciesChromosome.MEDIUM_CHROMOSOME_IMAGE
,
SpeciesChromosome.SHORT_CHROMOSOME_IMAGE
,
SpeciesChromosome.SHORTER_CHROMOSOME_IMAGE
,
SpeciesChromosome.SHORTEST_CHROMOSOME_IMAGE
,
SpeciesChromosome.TINY_CHROMOSOME_IMAGE
public void setImageNumber(int anImageNumber)
anImageNumber
- int - new image number of chromosomeObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic boolean isSexChromosome()
public int getChromosomeType()
public java.util.Enumeration getOrganismAlleles()
If there are no alleles on this chromosome, an enumeration with no elements is returned.
If there are alleles on this chromosome, the vector of alleles is cloned and an enumeration over that clone is returned. This enables you to safely modify the chromosome and its alleles while using the enumeration.
public int getNumberOfOrganismAlleles()
public void writeToStream(java.io.PrintWriter stream) throws java.io.IOException
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.
writeToStream
in class EngineObject
stream
- PrintWriter - print streamjava.lang.IllegalArgumentException
- - input arguments illegaljava.io.IOException
- - an IO error occurred in java librariespublic void setChromosomeBranchs(OrganismAllele[] P_Strand, java.awt.Color[] P_Strand_Color, OrganismAllele[] Q_Strand, java.awt.Color[] Q_Strand_Color)
public OrganismAllele[] getPStrand()
public java.awt.Color[] getPStrandColor()
public OrganismAllele[] getQStrand()
public java.awt.Color[] getQStrandColor()
public void setChromosomeViewHeight(int h)
public int getChromosomeViewHeight()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |