All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.bio.taxonomy.ncbi.NCBITaxonNameClass Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.bio.taxonomy.ncbi;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;


//------------------------------------------------------------------------------
/**
 * Enumerated list of NCBI taxon name classes.
 * 

* Based on values in the names.dmp file in ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz *

* * @author J. Alex Taylor, hairyfatguy.com */ //------------------------------------------------------------------------------ // com.hfg XML/HTML Coding Library // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com // [email protected] //------------------------------------------------------------------------------ public class NCBITaxonNameClass implements Serializable { //************************************************************************** // PRIVATE FIELDS //************************************************************************** private String mName; // Must be declared before the public NCBITaxonNameClass fields are constructed. private static Map sUniqueMap = new HashMap(20); //************************************************************************** // PUBLIC FIELDS //************************************************************************** public static NCBITaxonNameClass ACRONYM = new NCBITaxonNameClass("acronym"); public static NCBITaxonNameClass ANAMORPH = new NCBITaxonNameClass("anamorph"); public static NCBITaxonNameClass AUTHORITY = new NCBITaxonNameClass("authority"); public static NCBITaxonNameClass BLAST_NAME = new NCBITaxonNameClass("blast name"); public static NCBITaxonNameClass COMMON_NAME = new NCBITaxonNameClass("common name"); public static NCBITaxonNameClass EQUIVALENT_NAME = new NCBITaxonNameClass("equivalent name"); public static NCBITaxonNameClass GENBANK_ACRONYM = new NCBITaxonNameClass("genbank acronym"); public static NCBITaxonNameClass GENBANK_ANAMORPH = new NCBITaxonNameClass("genbank anamorph"); public static NCBITaxonNameClass GENBANK_COMMON_NAME = new NCBITaxonNameClass("genbank common name"); public static NCBITaxonNameClass GENBANK_SYNONYM = new NCBITaxonNameClass("genbank synonym"); public static NCBITaxonNameClass INCLUDES = new NCBITaxonNameClass("includes"); public static NCBITaxonNameClass IN_PART = new NCBITaxonNameClass("in-part"); public static NCBITaxonNameClass MISNOMER = new NCBITaxonNameClass("misnomer"); public static NCBITaxonNameClass MISSPELLING = new NCBITaxonNameClass("misspelling"); public static NCBITaxonNameClass SCIENTIFIC_NAME = new NCBITaxonNameClass("scientific name"); public static NCBITaxonNameClass SYNONYM = new NCBITaxonNameClass("synonym"); public static NCBITaxonNameClass TELEOMORPH = new NCBITaxonNameClass("teleomorph"); public static NCBITaxonNameClass TYPE_MATERIAL = new NCBITaxonNameClass("type material"); public static NCBITaxonNameClass UNPUBLISHED_NAME = new NCBITaxonNameClass("unpublished name"); //************************************************************************** // CONSTRUCTORS //************************************************************************** //-------------------------------------------------------------------------- private NCBITaxonNameClass(String inName) { mName = inName; if (sUniqueMap.containsKey(mName)) { throw new RuntimeException("A object already exists with the name '" + mName + "'!"); } sUniqueMap.put(mName, this); } //************************************************************************** // PUBLIC METHODS //************************************************************************** //-------------------------------------------------------------------------- public static Collection values() { return sUniqueMap.values(); } //-------------------------------------------------------------------------- public static NCBITaxonNameClass valueOf(String inValue) { return sUniqueMap.get(inValue); } //-------------------------------------------------------------------------- public String name() { return mName; } //-------------------------------------------------------------------------- /** The same as name(). */ @Override public String toString() { return name(); } //************************************************************************** // PRIVATE METHODS //************************************************************************** //-------------------------------------------------------------------------- /** * This method is called after de-serialization, allowing the object * to nominate a replacement object to be used in the output * graph instead of this object. We don't want multiple objects of each type * to exist in a target VM, so instances replace themselves with * local objects. */ private Object readResolve() { return sUniqueMap.get(mName); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy