Class SimpleNCBITaxon

    • Field Detail

      • names

        protected java.util.Set names
    • Constructor Detail

      • SimpleNCBITaxon

        public SimpleNCBITaxon​(int NCBITaxID)
        Creates a new instance of SimpleNCBITaxon based on the given taxon ID.
        Parameters:
        NCBITaxID - the underlying taxon ID from NCBI.
      • SimpleNCBITaxon

        public SimpleNCBITaxon​(java.lang.Integer NCBITaxID)
        Creates a new instance of SimpleNCBITaxon based on the given taxon ID. It may not be null, else you'll get exceptions.
        Parameters:
        NCBITaxID - the underlying taxon ID from NCBI.
    • Method Detail

      • compareTo

        public int compareTo​(java.lang.Object o)
        NCBITaxon objects are compared only by their NCBITaxID fields.
        Specified by:
        compareTo in interface java.lang.Comparable
      • equals

        public boolean equals​(java.lang.Object obj)
        NCBITaxon objects are equal if their NCBITaxID fields match.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getNameClasses

        public java.util.Set getNameClasses()
        Returns all the name classes available for a taxon. These are Strings.
        Specified by:
        getNameClasses in interface NCBITaxon
        Returns:
        a set of name classes, or the empty set if there are none.
      • getNames

        public java.util.Set getNames​(java.lang.String nameClass)
                               throws java.lang.IllegalArgumentException
        Returns all the names available for a taxon in a given class. These are Strings.
        Specified by:
        getNames in interface NCBITaxon
        Parameters:
        nameClass - the name class to retrieve names from.
        Returns:
        a set of names, or the empty set if there are none.
        Throws:
        java.lang.IllegalArgumentException - if the name is null.
      • getNameSet

        protected java.util.Set getNameSet()
      • addName

        public void addName​(java.lang.String nameClass,
                            java.lang.String name)
                     throws java.lang.IllegalArgumentException,
                            ChangeVetoException
        Adds the name to this taxon in the given name class. Neither can be null.
        Specified by:
        addName in interface NCBITaxon
        Parameters:
        nameClass - the class to add the name in.
        name - the name to add.
        Throws:
        java.lang.IllegalArgumentException - if the name is null.
        ChangeVetoException - in case of objections.
      • removeName

        public boolean removeName​(java.lang.String nameClass,
                                  java.lang.String name)
                           throws java.lang.IllegalArgumentException,
                                  ChangeVetoException
        Removes the name from the given name class. Neither can be null.
        Specified by:
        removeName in interface NCBITaxon
        Parameters:
        nameClass - the class to remove the name from.
        name - the name to remove.
        Returns:
        True if the name was found and removed, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the name is null.
        ChangeVetoException - in case of objections.
      • containsName

        public boolean containsName​(java.lang.String nameClass,
                                    java.lang.String name)
                             throws java.lang.IllegalArgumentException
        Tests for the presence of a name in a given class. Neither can be null.
        Specified by:
        containsName in interface NCBITaxon
        Parameters:
        nameClass - the class to look the name up in.
        name - the name to text for existence of.
        Returns:
        True if the name exists in that class, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the name is null.
      • getNamesMap

        protected final java.util.Map getNamesMap()
      • getNCBITaxID

        public int getNCBITaxID()
        Gets the NCBI taxon ID. This is never null and is immutable, as otherwise we would have no way of distinguishing between various taxa. It should be set by the constructor of an implementation.
        Specified by:
        getNCBITaxID in interface NCBITaxon
        Returns:
        Value of property NCBITaxID.
      • getNodeRank

        public java.lang.String getNodeRank()
        Gets the node rank of this taxon. May be null.
        Specified by:
        getNodeRank in interface NCBITaxon
        Returns:
        Value of property nodeRank.
      • getGeneticCode

        public java.lang.Integer getGeneticCode()
        Returns the genetic code of this taxon, which may be null if not known.
        Specified by:
        getGeneticCode in interface NCBITaxon
        Returns:
        Value of property geneticCode.
      • getMitoGeneticCode

        public java.lang.Integer getMitoGeneticCode()
        Getter for property mitoGeneticCode. Returns Persistent.NULL_INTEGER if null.
        Specified by:
        getMitoGeneticCode in interface NCBITaxon
        Returns:
        Value of property mitoGeneticCode.
      • getLeftValue

        public java.lang.Integer getLeftValue()
        Gets the left value. May be null.
        Specified by:
        getLeftValue in interface NCBITaxon
        Returns:
        Value of property leftValue.
      • getRightValue

        public java.lang.Integer getRightValue()
        Gets the right value. May be null.
        Specified by:
        getRightValue in interface NCBITaxon
        Returns:
        Value of property rightValue.
      • getDisplayName

        public java.lang.String getDisplayName()
        Returns the name of this taxon entry in the form: scientific (common) or if there is no common name: scientific or if there are no scientific names at all, the empty string.
        Specified by:
        getDisplayName in interface NCBITaxon
        Returns:
        the display name as described above.
      • isTaxonHidden

        public final boolean isTaxonHidden()
        Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific. It follows the chain up the tree as far as it can, and will stop at the first one it comes to that returns null for getParentNCBITaxID(). If this taxon entry has no scientific name, you will get the string ".".
        Specified by:
        isTaxonHidden in interface NCBITaxon
        Returns:
        the display name as described above.
      • getNameHierarchy

        public java.lang.String getNameHierarchy()
        Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific. It follows the chain up the tree as far as it can, and will stop at the first one it comes to that returns null for getParentNCBITaxID(). If this taxon entry has no scientific name, you will get the string ".".
        Specified by:
        getNameHierarchy in interface NCBITaxon
        Returns:
        the display name as described above.
      • toString

        public java.lang.String toString()
        Form: "taxid:[name,name...]"
        Overrides:
        toString in class java.lang.Object
      • getId

        public java.lang.Integer getId()
        Gets the Hibernate ID. Should be used with caution.
        Returns:
        the Hibernate ID, if using Hibernate.
      • setId

        public void setId​(java.lang.Integer id)
        Sets the Hibernate ID. Should be used with caution.
        Parameters:
        id - the Hibernate ID, if using Hibernate.