org.biojavax.bio.taxa
Class SimpleNCBITaxonName

java.lang.Object
  extended by org.biojavax.bio.taxa.SimpleNCBITaxonName
All Implemented Interfaces:
Comparable

public class SimpleNCBITaxonName
extends Object
implements Comparable

Represents a name class plus name combination for an NCBITaxon object.

Since:
1.5
Author:
Richard Holland

Constructor Summary
protected SimpleNCBITaxonName()
           
  SimpleNCBITaxonName(String nameClass, String name)
          Creates a new taxon name based on the given class and name, both of which cannot be null.
 
Method Summary
 int compareTo(Object o)
           Taxon names are sorted by class first, then name.
 boolean equals(Object o)
           Two taxon names are equal if their name and class match.
 String getName()
          Returns this name.
 String getNameClass()
          Returns the class of this name.
 int hashCode()
          
 void setName(String name)
          Changes the name.
 void setNameClass(String nameClass)
          Changes the class of this name.
 String toString()
           Form: "class:name"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleNCBITaxonName

protected SimpleNCBITaxonName()

SimpleNCBITaxonName

public SimpleNCBITaxonName(String nameClass,
                           String name)
Creates a new taxon name based on the given class and name, both of which cannot be null.

Parameters:
nameClass - the class of the new name. Use one of the constants from NCBITaxon (for example NCBITaxon.SCIENTIFIC).
name - the name itself
Method Detail

setNameClass

public void setNameClass(String nameClass)
Changes the class of this name.

Parameters:
nameClass - the new class for this name.

getNameClass

public String getNameClass()
Returns the class of this name.

Returns:
the class of this name.

setName

public void setName(String name)
Changes the name.

Parameters:
name - the new name.

getName

public String getName()
Returns this name.

Returns:
this name.

equals

public boolean equals(Object o)
Two taxon names are equal if their name and class match.

Overrides:
equals in class Object

compareTo

public int compareTo(Object o)
Taxon names are sorted by class first, then name.

Specified by:
compareTo in interface Comparable

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()
Form: "class:name"

Overrides:
toString in class Object