|
|||||||||
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.SpeciesAllele
This class represents a species allele - a known, fixed variation of a species gene.
An object of this class will generate the following property change events:
EngineProp.BASE_VALUES
,
EngineProp.DELETED
,
EngineProp.DESCRIPTION
,
EngineProp.ID
,
EngineProp.LOCKED_STATE
,
EngineProp.MUTATION_ALLELE
,
EngineProp.TEXT_SYMBOL
,
EngineProp.VISIBLE
,
EngineProp.WEIGHT
,
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 | |
SpeciesAllele(Gene aGene,
java.lang.String aTextSymbol,
byte[] baseValues)
Create a new allele given a gene and the base values to use. |
|
SpeciesAllele(Gene aGene,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new species allele and start handling XML parsing events to set the properties of this object. |
Method Summary | |
void |
addNucleicAcid(INucleicAcid aNucleicAcid)
Adds a nucleic acid to the holder. |
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 allele. |
byte[] |
getBases()
Get the base values array for this allele. |
java.lang.String |
getBasesAsString()
Get the bases as a String of characters A,T,C and G. |
java.lang.String |
getDescription()
Return the description of this allele. |
Gene |
getGene()
Returns the allele's gene. |
int |
getLengthInBases()
Returns the length of the allele in bases. |
int |
getLengthInCodons()
Returns the length of the allele in codons. |
Species |
getSpecies()
Get the species containing this object. |
SpeciesChromosome |
getSpeciesChromosome()
Get the species chromosome containing this object. |
int |
getStartIndexInHolder()
Returns the start index of this nucleic acid in its holder. |
java.lang.String |
getTextSymbol()
Returns the allele's text symbol. |
int |
getWeight()
Get the weight of this allele. |
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 |
isMutationAllele()
Is this allele the mutation allele for its gene? |
boolean |
isVisible()
Is this allele visible? |
boolean |
matchBases(byte[] inputBases)
Do the input bases match the bases of this allele? |
boolean |
removeNucleicAcid(INucleicAcid aNucleicAcid)
Removes a nucleic acid from the holder. |
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setBase(int index,
byte newBase)
Sets the base value at the given index in this allele. |
void |
setBases(byte[] newBases)
Sets the base values array for this allele. |
void |
setBasesAsString(java.lang.String bases)
Sets the bases for this allele using a String as input. |
void |
setDescription(java.lang.String aDescription)
Set the description of this allele. |
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 |
setMutationAllele(boolean aMutationAllele)
Set whether or not this allele is the mutation allele for its gene. |
void |
setTextSymbol(java.lang.String aTextSymbol)
Set the text symbol of the allele. |
void |
setVisible(boolean aVisible)
Set whether or not this allele is visible. |
void |
setWeight(int aWeight)
Set the weight of this allele. |
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 |
Methods inherited from interface org.concord.biologica.engine.INucleicAcidHolder |
getID |
Constructor Detail |
public SpeciesAllele(Gene aGene, java.lang.String aTextSymbol, byte[] baseValues)
aGene
- Gene - the gene of this allele, may not be nullaTextSymbol
- String - textual symbol of this allele (e.g. "h", "H"), may not be nullbaseValues
- byte[] - base values array, may not be null or zero lengthjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic SpeciesAllele(Gene aGene, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
aGene
- Gene - the enclosing gene for this new species alleleanElementName
- 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 interface INucleicAcidHolder
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 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 boolean isMutationAllele()
public void setMutationAllele(boolean aMutationAllele)
aMutationAllele
- boolean - is this allele the mutation allele for its gene?public boolean isVisible()
public void setVisible(boolean aVisible)
aVisible
- boolean - is this allele visible?public java.lang.String getTextSymbol()
public void setTextSymbol(java.lang.String aTextSymbol)
aTextSymbol
- String - new text symbol for object, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic Gene getGene()
public SpeciesChromosome getSpeciesChromosome()
public Species getSpecies()
public World getWorld()
getWorld
in interface INucleicAcidHolder
getWorld
in class EngineObject
public int getLengthInBases()
public int getLengthInCodons()
public byte getBase(int index)
index
- int - index into allele, must be 0 to length of allele-1java.lang.IllegalArgumentException
- - input argument(s) illegalBase.getPairBase(byte, int)
public java.lang.String getBasesAsString()
public void setBase(int index, byte newBase)
When this property is changed, a property change event is generated for the property named EngineProp.BASE_VALUES.
index
- int - index into allele, must be 0 to length of allele-1newBase
- byte - new base value at given indexjava.lang.IllegalArgumentException
- - input argument(s) illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic byte[] getBases()
public void setBases(byte[] newBases)
When this property is changed, a property change event is generated for the property named EngineProp.BASE_VALUES.
newBases
- byte[] - new base values arrayjava.lang.IllegalArgumentException
- - input argument(s) illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic void setBasesAsString(java.lang.String bases)
String
- - bases in a string using A,T,C and G characters, may be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be deletedpublic boolean matchBases(byte[] inputBases)
inputBases
- byte[] - input basespublic int getStartIndexInHolder()
For an allele, this is always zero as the allele's position in the chromosome isn't known to the allele, but rather its gene.
public void addNucleicAcid(INucleicAcid aNucleicAcid)
This SHOULD be package protected because this is only to be called from the nucleic acid's constructor. Creating a nucleic acid automatically adds it to the holder via this method.
BUT, Java has some wierd idea that interface methods are always public, so I can't make this package protected. So please don't use them method from outside of the engine package!!
addNucleicAcid
in interface INucleicAcidHolder
aNucleicAcid
- INucleicAcid - a new nucleic acid, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalpublic boolean removeNucleicAcid(INucleicAcid aNucleicAcid)
This SHOULD be package protected because this is only to be called from the nucleic acid's delete method. Deleting a nucleic acid automatically removes it from the holder via this method.
BUT, Java has some wierd idea that interface methods are always public, so I can't make this package protected. So please don't use them method from outside of the engine package!!
removeNucleicAcid
in interface INucleicAcidHolder
aNucleicAcid
- INucleicAcid - a nucleic acid, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalpublic int getWeight()
public void setWeight(int aWeight)
aWeight
- int - new weight of this allele, must be zero or greaterjava.lang.IllegalArgumentException
- - weight less than zeropublic java.lang.String getDescription()
public void setDescription(java.lang.String aDescription)
When this method is successful, a property change event is fired for the property named EngineProp.DESCRIPTION.
aDescription
- String - the new description of this allele, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be modifiedpublic 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 |