001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 * Created on Jun 30, 2010
021 * Author: ap3
022 *
023 */
024
025package org.biojava.nbio.structure.scop;
026
027import java.io.Serializable;
028
029/** The various categories provided by SCOP.
030 *
031 * The SCOP node types are 'cl' (Class),
032 * 'cf' (Fold), 'sf' (Superfamily), 'fa' (Family), 'dm' (Domain),
033 *  'sp' (Species), 'px' (protein).
034 *
035 * @author Andreas Prlic
036 *
037 */
038public enum ScopCategory implements Serializable
039{
040
041        Class,Fold, Superfamily,  Family, Domain, Species, Px;
042
043        public static ScopCategory fromString(String type){
044                if ( type.equals("cl"))
045                        return Class;
046                else if ( type.equals("cf"))
047                        return Fold;
048                else if ( type.equals("sf"))
049                        return Superfamily;
050                else if ( type.equals("fa"))
051                        return Family;
052                else if ( type.equals("dm"))
053                        return Domain;
054                else if ( type.equals("sp"))
055                        return Species;
056                else
057                        return Px;
058        }
059
060        @Override
061public String toString(){
062                switch (this) {
063                        case Class:
064                                return "cl";
065
066                        case Fold:
067                                return "cf";
068
069                        case Superfamily:
070                                return "sf";
071
072                        case Family:
073                                return "fa";
074
075                        case Domain:
076                                return "dm";
077
078                        case Species:
079                                return "sp";
080
081                         default:
082                                 return "px";
083                }
084        }
085}