org.biojavax.bio.taxapublic abstract class AbstractTaxon extends AbstractChangeable implements Taxon
An abstract implementation of Taxon.
It is left up to the impementor to provide methods for accessing the parent and children. All other state is provided for here. A common pattern would be to route any Taxon.getParent() call back via a method on the TaxonFactory used to generate this instance.
Annotatable.AnnotationForwarderCHANGE_COMMON_NAME, CHANGE_SCIENTIFIC_NAMEANNOTATION| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTaxon()
Deprecated.
|
protected |
AbstractTaxon(String scientificName,
String commonName)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Deprecated.
Two taxa are equal if they have equivalent children, common
and scientific names.
|
Annotation |
getAnnotation()
Deprecated.
Should return the associated annotation object.
|
protected ChangeSupport |
getChangeSupport(ChangeType ct)
Deprecated.
Called to retrieve the ChangeSupport for this object.
|
String |
getCommonName()
Deprecated.
The common name of the Taxon.
|
String |
getScientificName()
Deprecated.
The scientific name of this taxon.
|
int |
hashCode()
Deprecated.
The hash-code of a Taxon is equal to the hash-code of it's
scientific name.
|
void |
setCommonName(String commonName)
Deprecated.
Set the new common name of this Taxon.
|
void |
setScientificName(String scientificName)
Deprecated.
Change the scientific name of this species.
|
String |
toString()
Deprecated.
|
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetChildren, getParentaddChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerprotected AbstractTaxon()
protected AbstractTaxon(String scientificName, String commonName)
protected ChangeSupport getChangeSupport(ChangeType ct)
AbstractChangeable
Your implementation of this method should have the following structure:
It is usual for the forwarding listeners (someForwarder in this example) to
be transient and lazily instantiated. Be sure to register & unregister the
forwarder in the code that does the ChangeEvent handling in setter methods.
ChangeSupport cs = super.getChangeSupport(ct);
if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
someForwarder = new ChangeForwarder(...
this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
}
return cs;
getChangeSupport in class AbstractChangeablepublic String getCommonName()
TaxonThe common name of the Taxon.
This is the normal name used in common speech, such as 'human'.
getCommonName in interface Taxonpublic void setCommonName(String commonName) throws ChangeVetoException
TaxonSet the new common name of this Taxon.
setCommonName in interface TaxoncommonName - the new common nameChangeVetoException - if the name can't be changed at this timepublic String getScientificName()
TaxonThe scientific name of this taxon.
This will be the portion of the scientific classification pertaining to just this node within the classifictaion. It will be something like 'homo sapiens' or 'archaeal group 2', rather than the full classification list.
getScientificName in interface Taxonpublic void setScientificName(String scientificName) throws ChangeVetoException
TaxonsetScientificName in interface TaxonscientificName - the new scientific nameChangeVetoException - if the scientific name can't be
changed at this timepublic Annotation getAnnotation()
AnnotatablegetAnnotation in interface Annotatablepublic boolean equals(Object o)
TaxonTwo taxa are equal if they have equivalent children, common and scientific names.
Two different implementations of Taxon should be able to appropriately trans-class equality. The parent of a Taxon is not considered in testing equality as this potentially leads to combinatorial problems checking whole taxa hierachies against one another.
Copyright © 2014 BioJava. All rights reserved.