Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojavax.bio.taxa
Class SimpleNCBITaxon

    java.lang.Object
      org.biojava.utils.AbstractChangeable
          org.biojavax.bio.taxa.SimpleNCBITaxon

All Implemented Interfaces:
  Comparable, Changeable, NCBITaxon

    public class SimpleNCBITaxon

extends AbstractChangeable
implements NCBITaxon

Reference implementation of NCBITaxon.

Since:
  1.5
Author:
  Richard Holland, Mark Schreiber, David Scott

Field Summary
`protected Set` | `names`

Fields inherited from interface org.biojavax.bio.taxa.NCBITaxon
`ACRONYM, COMMON, EQUIVALENT, GENETICCODE, HIDDEN, LEFTVALUE, MITOGENETICCODE, NAMES, NODERANK, PARENT, RIGHTVALUE, SCIENTIFIC, SYNONYM`

Constructor Summary
`protected` | `SimpleNCBITaxon()`
`` | `SimpleNCBITaxon(int NCBITaxID)` Creates a new instance of SimpleNCBITaxon based on the given taxon ID.
`` | `SimpleNCBITaxon(Integer NCBITaxID)` Creates a new instance of SimpleNCBITaxon based on the given taxon ID.

Method Summary
`void` | `addName(String nameClass, String name)` Adds the name to this taxon in the given name class.
`int` | `compareTo(Object o)` NCBITaxon objects are compared only by their NCBITaxID fields.
`boolean` | `containsName(String nameClass, String name)` Tests for the presence of a name in a given class.
`boolean` | `equals(Object obj)` NCBITaxon objects are equal if their NCBITaxID fields match.
`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.
`Integer` | `getGeneticCode()` Returns the genetic code of this taxon, which may be null if not known.
`Integer` | `getId()` Gets the Hibernate ID.
`Integer` | `getLeftValue()` Gets the left value.
`Integer` | `getMitoGeneticCode()` Getter for property mitoGeneticCode.
`Set` | `getNameClasses()` Returns all the name classes available for a taxon.
`String` | `getNameHierarchy()` Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific.
`Set` | `getNames(String nameClass)` Returns all the names available for a taxon in a given class.
`protected Set` | `getNameSet()`
`protected Map` | `getNamesMap()`
`int` | `getNCBITaxID()` Gets the NCBI taxon ID.
`String` | `getNodeRank()` Gets the node rank of this taxon.
`Integer` | `getParentNCBITaxID()` Returns the parent NCBI taxon ID, if known.
`Integer` | `getRightValue()` Gets the right value.
`int` | `hashCode()`
`boolean` | `isTaxonHidden()` Returns the taxonomy hierarchy of this taxon entry in the form: most specific; less specific; ...; least specific.
`boolean` | `removeName(String nameClass, String name)` Removes the name from the given name class.
`void` | `setGeneticCode(Integer geneticCode)` Sets the genetic code of this taxon, which may be null, which will unset it.
`void` | `setId(Integer id)` Sets the Hibernate ID.
`void` | `setLeftValue(Integer leftValue)` Sets the left value.
`void` | `setMitoGeneticCode(Integer mitoGeneticCode)` Sets the mitochondrial genetic code of this taxon, which may be null, which will unset it.
`void` | `setNodeRank(String nodeRank)` Setter for property nodeRank.
`void` | `setParentNCBITaxID(Integer parent)` Sets the parent NCBI taxon ID.
`void` | `setRightValue(Integer rightValue)` Sets the right value.
`void` | `setTaxonHidden(boolean isTaxonHidden)` determines whether this taxonomy level is displayed in etNameHierarchy()
`String` | `toString()` Form: "taxid:[name,name...]"

Methods inherited from class org.biojava.utils.AbstractChangeable
`addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, 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.utils.Changeable
`addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener`

Field Detail

### names

    protected 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(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.

### SimpleNCBITaxon

    protected SimpleNCBITaxon()

Method Detail

### compareTo

    public int compareTo(Object o)

  NCBITaxon objects are compared only by their NCBITaxID fields.

  Specified by:
    `compareTo` in interface `Comparable`

### equals

    public boolean equals(Object obj)

  NCBITaxon objects are equal if their NCBITaxID fields match.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### getNameClasses

    public 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 Set getNames(String nameClass)
                 throws 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:
    `IllegalArgumentException` - if the name is null.

### getNameSet

    protected Set getNameSet()

### addName

    public void addName(String nameClass,
                        String name)
                 throws 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:
    `IllegalArgumentException` - if the name is null.
    `ChangeVetoException` - in case of objections.

### removeName

    public boolean removeName(String nameClass,
                              String name)
                       throws 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:
    `IllegalArgumentException` - if the name is null.
    `ChangeVetoException` - in case of objections.

### containsName

    public boolean containsName(String nameClass,
                                String name)
                         throws 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:
    `IllegalArgumentException` - if the name is null.

### getNamesMap

    protected final Map getNamesMap()

### getParentNCBITaxID

    public Integer getParentNCBITaxID()

  Returns the parent NCBI taxon ID, if known.

  Specified by:
    `getParentNCBITaxID` in interface `NCBITaxon`
  Returns:
    Value of property parent.

### setParentNCBITaxID

    public void setParentNCBITaxID(Integer parent)
                            throws ChangeVetoException

  Sets the parent NCBI taxon ID. May be null if not known.

  Specified by:
    `setParentNCBITaxID` in interface `NCBITaxon`
  Parameters:
    `parent` - New value of property parent.
  Throws:
    `ChangeVetoException` - in case of objections.

### 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 String getNodeRank()

  Gets the node rank of this taxon. May be null.

  Specified by:
    `getNodeRank` in interface `NCBITaxon`
  Returns:
    Value of property nodeRank.

### setNodeRank

    public void setNodeRank(String nodeRank)
                     throws ChangeVetoException

  Setter for property nodeRank.

  Specified by:
    `setNodeRank` in interface `NCBITaxon`
  Parameters:
    `nodeRank` - New value of property nodeRank.
  Throws:
    `ChangeVetoException` - in case of objections.

### getGeneticCode

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

### setGeneticCode

    public void setGeneticCode(Integer geneticCode)
                        throws ChangeVetoException

  Sets the genetic code of this taxon, which may be null, which will unset it.

  Specified by:
    `setGeneticCode` in interface `NCBITaxon`
  Parameters:
    `geneticCode` - New value of property geneticCode.
  Throws:
    `ChangeVetoException` - in case of objections.

### getMitoGeneticCode

    public Integer getMitoGeneticCode()

  Getter for property mitoGeneticCode. Returns Persistent.NULL_INTEGER if null.

  Specified by:
    `getMitoGeneticCode` in interface `NCBITaxon`
  Returns:
    Value of property mitoGeneticCode.

### setMitoGeneticCode

    public void setMitoGeneticCode(Integer mitoGeneticCode)
                            throws ChangeVetoException

  Sets the mitochondrial genetic code of this taxon, which may be null, which will unset it.

  Specified by:
    `setMitoGeneticCode` in interface `NCBITaxon`
  Parameters:
    `mitoGeneticCode` - New value of property mitoGeneticCode.
  Throws:
    `ChangeVetoException` - in case of objections.

### getLeftValue

    public Integer getLeftValue()

  Gets the left value. May be null.

  Specified by:
    `getLeftValue` in interface `NCBITaxon`
  Returns:
    Value of property leftValue.

### setLeftValue

    public void setLeftValue(Integer leftValue)
                      throws ChangeVetoException

  Sets the left value. May be null.

  Specified by:
    `setLeftValue` in interface `NCBITaxon`
  Parameters:
    `leftValue` - New value of property leftValue.
  Throws:
    `ChangeVetoException` - in case of objections.

### getRightValue

    public Integer getRightValue()

  Gets the right value. May be null.

  Specified by:
    `getRightValue` in interface `NCBITaxon`
  Returns:
    Value of property rightValue.

### setRightValue

    public void setRightValue(Integer rightValue)
                       throws ChangeVetoException

  Sets the right value. May be null.

  Specified by:
    `setRightValue` in interface `NCBITaxon`
  Parameters:
    `rightValue` - New value of property rightValue.
  Throws:
    `ChangeVetoException` - in case of objections.

### getDisplayName

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

### setTaxonHidden

    public final void setTaxonHidden(boolean isTaxonHidden)
                              throws ChangeVetoException

  Description copied from interface: `NCBITaxon`
  determines whether this taxonomy level is displayed in etNameHierarchy()

  Specified by:
    `setTaxonHidden` in interface `NCBITaxon`
  Parameters:
    `isTaxonHidden` - - if true it is displayed
  Throws:
    `ChangeVetoException`

### getNameHierarchy

    public 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 String toString()

  Form: "taxid:[name,name...]"

  Overrides:
    `toString` in class `Object`

### getId

    public Integer getId()

  Gets the Hibernate ID. Should be used with caution.

  Returns:
    the Hibernate ID, if using Hibernate.

### setId

    public void setId(Integer id)

  Sets the Hibernate ID. Should be used with caution.

  Parameters:
    `id` - the Hibernate ID, if using Hibernate.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD