org.biojava.bio.taxa
Class AbstractTaxon

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojava.bio.taxa.AbstractTaxon
All Implemented Interfaces:
Annotatable, Taxon, Changeable
Direct Known Subclasses:
SimpleTaxon, WeakTaxon

Deprecated. replaced by classes in org.biojavax.bio.taxa

public 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.

Since:
1.3
Author:
Matthew Pocock, Keith James

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
 
Field Summary
 
Fields inherited from interface org.biojava.bio.taxa.Taxon
CHANGE_COMMON_NAME, CHANGE_SCIENTIFIC_NAME
 
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
 
Constructor Summary
protected AbstractTaxon()
          Deprecated.  
protected AbstractTaxon(String scientificName, String commonName)
          Deprecated.  
 
Method Summary
 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.  
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.taxa.Taxon
getChildren, getParent
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

AbstractTaxon

protected AbstractTaxon()
Deprecated. 

AbstractTaxon

protected AbstractTaxon(String scientificName,
                        String commonName)
Deprecated. 
Method Detail

getChangeSupport

protected ChangeSupport getChangeSupport(ChangeType ct)
Deprecated. 
Description copied from class: AbstractChangeable
Called to retrieve the ChangeSupport for this object.

Your implementation of this method should have the following structure:

 ChangeSupport cs = super.getChangeSupport(ct);

 if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
   someForwarder = new ChangeForwarder(...

   this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
 }

 return cs;
 
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.

Overrides:
getChangeSupport in class AbstractChangeable

getCommonName

public String getCommonName()
Deprecated. 
Description copied from interface: Taxon

The common name of the Taxon.

This is the normal name used in common speech, such as 'human'.

Specified by:
getCommonName in interface Taxon
Returns:
a String representing this Taxon's common name

setCommonName

public void setCommonName(String commonName)
                   throws ChangeVetoException
Deprecated. 
Description copied from interface: Taxon

Set the new common name of this Taxon.

Specified by:
setCommonName in interface Taxon
Parameters:
commonName - the new common name
Throws:
ChangeVetoException - if the name can't be changed at this time

getScientificName

public String getScientificName()
Deprecated. 
Description copied from interface: Taxon

The 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.

Specified by:
getScientificName in interface Taxon

setScientificName

public void setScientificName(String scientificName)
                       throws ChangeVetoException
Deprecated. 
Description copied from interface: Taxon
Change the scientific name of this species.

Specified by:
setScientificName in interface Taxon
Parameters:
scientificName - the new scientific name
Throws:
ChangeVetoException - if the scientific name can't be changed at this time

getAnnotation

public Annotation getAnnotation()
Deprecated. 
Description copied from interface: Annotatable
Should return the associated annotation object.

Specified by:
getAnnotation in interface Annotatable
Returns:
an Annotation object, never null

equals

public boolean equals(Object o)
Deprecated. 
Description copied from interface: Taxon

Two 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.

Specified by:
equals in interface Taxon
Overrides:
equals in class Object
Parameters:
o - the object to check
Returns:
true if o is a Taxon instance and has the same properties as this

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

hashCode

public int hashCode()
Deprecated. 
Description copied from interface: Taxon
The hash-code of a Taxon is equal to the hash-code of it's scientific name.

Specified by:
hashCode in interface Taxon
Overrides:
hashCode in class Object