|
|||||||||
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.NucleicAcid
This class represents a container nucleic acid, which is little more than a collection of other nucleic acids, some of which are alleles, some algorithmic sequences, some containers, etc.
This class may be used for both DNA and RNA.
This class hides the different types of nucleic acids from casual users of the class, creating children of the various types as needed and storing them in a vector. For example, an autosome just needs to store a reference to an instance of this class and doesn't need to worry about what form of nucleic acid object is stored within this object (raw, etc.).
An object of this class will generate the following property change events:
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.IN_DNA_OR_RNA
,
EngineProp.LOCKED_STATE
,
EngineProp.NAME
,
EngineProp.NUCLEIC_ACID_ADDED
,
EngineProp.NUCLEIC_ACID_REMOVED
,
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 | |
NucleicAcid(INucleicAcidHolder aHolder,
int startIndexInHolder,
byte[] baseValues,
int inDNAorRNA)
Creates a new nucleic acid from the given base values. |
|
NucleicAcid(INucleicAcidHolder aHolder,
int startIndexInHolder,
java.util.Vector nucleicAcids,
int inDNAorRNA)
Creates a new nucleic acid from the given vector of nucleic acids, which is handy when the vector is created during meiosis. |
Method Summary | |
void |
addNucleicAcid(INucleicAcid aNucleicAcid)
Adds a nucleic acid to the holder. |
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. |
byte |
getBase(int index)
Returns the base value at the given index in this sequence. |
INucleicAcidHolder |
getHolder()
Returns the raw nucleic acid's holder. |
int |
getLengthInBases()
Returns the length of the nucleic acid by summing up the lengths of all of the child nucleic acids. |
int |
getLengthInCodons()
Returns the length of the nucleic acid in codons by summing up the lengths in codons of all of the child nucleic acids. |
int |
getStartIndexInHolder()
Returns the start index of this nucleic acid in its holder. |
World |
getWorld()
Returns the world containing this nucleic acid. |
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 |
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 |
setStartIndexInHolder(int anIndex)
Set the start index of this nucleic acid in its holder. |
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 |
characters, endDocument, endElement, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startElement, 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 |
endElement, getID |
Constructor Detail |
public NucleicAcid(INucleicAcidHolder aHolder, int startIndexInHolder, byte[] baseValues, int inDNAorRNA)
aHolder
- INucleicAcidHolder - holder of this nucleic acid, may not be nullstartIndexInHolder
- int - start index of this nucleic acid in holderbaseValues
- byte[] - base values array, may not be null or zero lengthinDNAorRNA
- int - in DNA or RNA?, must be Base.IN_DNA or Base.IN_RNAjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic NucleicAcid(INucleicAcidHolder aHolder, int startIndexInHolder, java.util.Vector nucleicAcids, int inDNAorRNA)
aHolder
- INucleicAcidHolder - holder of this nucleic acid, may not be nullstartIndexInHolder
- int - start index of this nucleic acid in holdernucleicAcids
- Vector - vector of existing nucleic acids, may be null or emptyinDNAorRNA
- int - in DNA or RNA?, must be Base.IN_DNA or Base.IN_RNAjava.lang.IllegalArgumentException
- - input argument(s) illegalMethod Detail |
public void delete()
When this method is called, a property change event is generated for the property named EngineProp.DELETED.
delete
in interface INucleicAcid
delete
in class EngineObject
public void delete(boolean notifyChange)
INucleicAcid
delete
in interface INucleicAcid
public INucleicAcidHolder getHolder()
getHolder
in interface INucleicAcid
public World getWorld()
getWorld
in interface INucleicAcidHolder
getWorld
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 interface INucleicAcid
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 interface INucleicAcid
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 interface INucleicAcid
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 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 acid (in bases), must be 0 to length of acid in bases-1java.lang.IllegalArgumentException
- - input argument(s) illegalBase.getPairBase(byte, int)
public 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 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 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 |