Class AbstractTaxon

  • All Implemented Interfaces:
    Annotatable, Taxon, Changeable
    Direct Known Subclasses:
    SimpleTaxon, WeakTaxon

    public abstract class AbstractTaxon
    extends AbstractChangeable
    implements Taxon
    replaced by classes in

    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.

    Matthew Pocock, Keith James
    • Method Detail

      • getChangeSupport

        protected ChangeSupport getChangeSupport​(ChangeType ct)
        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.
        getChangeSupport in class AbstractChangeable
      • getCommonName

        public String getCommonName()
        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
        a String representing this Taxon's common name
      • getScientificName

        public String getScientificName()
        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
      • equals

        public boolean equals​(Object o)
        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
        equals in class Object
        o - the object to check
        true if o is a Taxon instance and has the same properties as this
      • hashCode

        public int hashCode()
        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
        hashCode in class Object