|
|||||||||
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.RawNucleicAcid
This class represents a nucleic acid stored as a sequence of base values.
An object of this class will generate the following property change events:
EngineProp.BASE_VALUES
,
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.IN_DNA_OR_RNA
,
EngineProp.LOCKED_STATE
,
EngineProp.START_INDEX_IN_HOLDER
,
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 | |
RawNucleicAcid(INucleicAcidHolder aHolder,
int startIndexInHolder,
byte[] baseValues,
int inDNAorRNA)
Create a new raw nucleic acid given some base values. |
|
RawNucleicAcid(INucleicAcidHolder aHolder,
int startIndexInHolder,
RawNucleicAcid aRawNucleicAcid,
int inDNAorRNA)
Create a new raw nucleic acid in the given holder from a given raw nucleic acid. |
|
RawNucleicAcid(INucleicAcidHolder aHolder,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new raw nucleic acid 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)
Delete this nucleic acid - redundant with EngineObject in most cases. |
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 raw nucleic acid. |
byte[] |
getBases()
Get the bases of this raw nucleic acid as an array of bytes. |
INucleicAcidHolder |
getHolder()
Returns the raw nucleic acid's holder. |
int |
getLengthInBases()
Returns the length of the raw nucleic acid in bases. |
int |
getLengthInCodons()
Returns the length of the raw nucleic acid in codons, which is calculated by dividing the length in bases by 3, ignoring any remainder. |
int |
getStartIndexInHolder()
Returns the start index of this nucleic acid in its holder. |
World |
getWorld()
Returns the world containing this nucleic acid. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
void |
setBase(int index,
byte newBase)
Sets the base value at the given index in this nucleic acid. |
void |
setBases(byte[] newBases)
Sets the base values array for this nucleic acid. |
void |
setStartIndexInHolder(int anIndex)
Set the start index of this nucleic acid in its holder. |
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, setAutomaticLocked, setID, setLockedState, setLockedStateAsString, setManualLocked |
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.INucleicAcid |
setAutomaticLocked, setLockedState, setManualLocked |
Constructor Detail |
public RawNucleicAcid(INucleicAcidHolder aHolder, int startIndexInHolder, byte[] baseValues, int inDNAorRNA)
aHolder
- INucleicAcidHolder - holder of this nucleic acid (e.g. allele), may not be nullstartIndexInHolder
- int - index of the raw nucleic acid in its holderbaseValues
- byte[] - base values array, may be null or zero lengthinDNAorRNA
- int - Base.IN_DNA or Base.IN_RNAjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic RawNucleicAcid(INucleicAcidHolder aHolder, int startIndexInHolder, RawNucleicAcid aRawNucleicAcid, int inDNAorRNA)
aHolder
- INucleicAcidHolder - holder of this nucleic acid (e.g. allele, chromosome), may not be nullstartIndexInHolder
- int - start index of raw nucleic acid in the given holderRawNucleicAcid
- aRawNucleicAcid - an existing raw nucleic acidinDNAorRNA
- int - Base.IN_DNA or Base.IN_RNAjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic RawNucleicAcid(INucleicAcidHolder aHolder, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
aHolder
- INucleicAcidHolder - the enclosing holder for this raw nucleic acidanElementName
- 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()
delete
in interface INucleicAcid
delete
in class EngineObject
public void delete(boolean notifyChange)
INucleicAcid
delete
in interface INucleicAcid
public java.lang.String toString()
toString
in class EngineObject
public INucleicAcidHolder getHolder()
getHolder
in interface INucleicAcid
public World getWorld()
getWorld
in class EngineObject
public int getLengthInBases()
getLengthInBases
in interface INucleicAcid
public int getLengthInCodons()
getLengthInCodons
in interface INucleicAcid
public byte getBase(int index)
getBase
in interface INucleicAcid
index
- int - index into autosome, must be 0 to length of autosome-1java.lang.IllegalArgumentException
- - input argument(s) illegalBase.getPairBase(byte, int)
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 nucleic acid-1newBase
- byte - new base value at given indexjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic 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 array, may be nullpublic int getStartIndexInHolder()
getStartIndexInHolder
in interface INucleicAcid
public void setStartIndexInHolder(int anIndex)
When this property is changed, a property change event is generated for the property named EngineProp.START_INDEX_IN_HOLDER.
int
- - new index in holder, must be between 0 and the length in basespublic 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 interface INucleicAcid
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 |