|
|||||||||
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.SpeciesChromosome
This class represents a species chromosome - a chromosome which has a length, some genes and their alleles, etc. This chromosome does NOT have any algorithmic DNA in it and thus is not a chromosome that would be found in an organism. See OrganismChromosome for the chromosome class for organisms.
An object of this class will generate the following property change events:
EngineProp.BASE_VALUES
,
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.GENE_ADDED
,
EngineProp.GENE_REMOVED
,
EngineProp.IMAGE_NUMBER
,
EngineProp.LENGTH_IN_BASES
,
EngineProp.LOCKED_STATE
,
EngineProp.NUMBER_TYPE
,
EngineProp.VISIBLE
,
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 |
Fields inherited from interface org.concord.biologica.engine.IChromosome |
A_CHROMOSOME, AUTOSOME, B_CHROMOSOME, C_CHROMOSOME, NEXT_HIGHEST_AUTOSOME_NUMBER, SEX_CHROMOSOME, X_CHROMOSOME, X_CHROMOSOME_STRING, Y_CHROMOSOME, Y_CHROMOSOME_STRING |
Constructor Summary | |
SpeciesChromosome(Species aSpecies,
int aNumberType,
int aLengthInBases)
Create a new species chromosome. |
|
SpeciesChromosome(Species aSpecies,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new species 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. |
static java.lang.String |
convertChromosomeNumberTypeToString(int aNumberType)
Convert a chromosome number type to a string. |
static int |
convertStringToChromosomeNumberType(java.lang.String aNumberTypeString)
Convert a chromosome number type string to an int |
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. |
int |
getChromosomeType()
Get the chromosome type (autosome or sex chromosome). |
java.util.Enumeration |
getGenes()
Returns an enumeration over the vector of genes in this chromosome. |
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, calculated by dividing the number of bases by 3, ignoring remainder. |
int |
getNumberOfGenes()
Return the number of genes in this chromosome. |
int |
getNumberType()
Returns the number / type of this chromosome. |
java.lang.String |
getNumberTypeAsString()
Returns the number / type of this chromosome. |
Species |
getSpecies()
Returns the chromosome's species. |
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 whether this chromosome is visible. |
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setImageNumber(int anImageNumber)
Sets the image number of this chromosome. |
void |
setLengthInBases(int aLengthInBases)
Sets the length of the chromosome in bases. |
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 |
setVisible(boolean TorF)
Set whether this chromosome is visible. |
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, based on the chromosome's number type. |
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 |
public static final int LONGEST_CHROMOSOME_IMAGE
public static final int LONGER_CHROMOSOME_IMAGE
public static final int LONG_CHROMOSOME_IMAGE
public static final int MEDIUM_CHROMOSOME_IMAGE
public static final int SHORT_CHROMOSOME_IMAGE
public static final int SHORTER_CHROMOSOME_IMAGE
public static final int SHORTEST_CHROMOSOME_IMAGE
public static final int TINY_CHROMOSOME_IMAGE
public static final int NUMBER_P_STRAND_SEGMENTS_LONGEST_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_LONGEST_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_LONGER_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_LONGER_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_LONG_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_LONG_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_MEDIUM_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_MEDIUM_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_SHORT_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_SHORT_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_SHORTER_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_SHORTER_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_SHORTEST_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_SHORTEST_CHROMOSOME
public static final int NUMBER_P_STRAND_SEGMENTS_TINY_CHROMOSOME
public static final int NUMBER_Q_STRAND_SEGMENTS_TINY_CHROMOSOME
Constructor Detail |
public SpeciesChromosome(Species aSpecies, int aNumberType, int aLengthInBases)
aSpecies
- Species - the species containing this chromosome, may not be nullaNumberType
- int - IChromosome.X_CHROMOSOME, IChromosome.Y_CHROMOSOME,
IChromosome.NEXT_HIGHEST_AUTOSOME_NUMBER or a number greater than or equal to 1.aLengthInBases
- int - length of chromosome in bases, must be greater than zerojava.lang.IllegalArgumentException
- - input argument(s) illegalpublic SpeciesChromosome(Species aSpecies, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
aSpecies
- Species - the enclosing species for this new species 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 static java.lang.String convertChromosomeNumberTypeToString(int aNumberType)
aNumberType
- int - chromosome number type in int formpublic static int convertStringToChromosomeNumberType(java.lang.String aNumberTypeString) throws java.lang.NumberFormatException
aNumberTypeString
- String - chromosome number type in string formjava.lang.NumberFormatException
- - if string not an acceptable numberpublic 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 java.lang.String toString()
toString
in class EngineObject
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 Species getSpecies()
public World getWorld()
getWorld
in class EngineObject
public int getLengthInBases()
getLengthInBases
in interface IChromosome
public void setLengthInBases(int aLengthInBases)
When this method is successful, a property change event is fired for the property named EngineProp.LENGTH_IN_BASES.
aLengthInBases
- int - new length in basesjava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic int getLengthInCodons()
getLengthInCodons
in interface IChromosome
public int getNumberType()
getNumberType
in interface IChromosome
public java.lang.String getNumberTypeAsString()
public void setNumberType(int aNumberType)
aNumberType
- int - new number or type of chromosomeObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic 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()
LONGEST_CHROMOSOME_IMAGE
,
LONGER_CHROMOSOME_IMAGE
,
LONG_CHROMOSOME_IMAGE
,
MEDIUM_CHROMOSOME_IMAGE
,
SHORT_CHROMOSOME_IMAGE
,
SHORTER_CHROMOSOME_IMAGE
,
SHORTEST_CHROMOSOME_IMAGE
,
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()
isSexChromosome
in interface IChromosome
public int getChromosomeType()
getChromosomeType
in interface IChromosome
public java.util.Enumeration getGenes()
The vector of genes is cloned and the enumeration is created for the clone, so it is safe to modify the vector of genes (by creating new ones, moving them around, etc.) while using this returned enumeration.
public int getNumberOfGenes()
public boolean isVisible()
public void setVisible(boolean TorF)
TorF
- boolean - visible (true) or not visible (false)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 libraries
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |