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 May 30, 2010
021 * Author: Jianjiong Gao
022 *
023 */
024
025package org.biojava.nbio.protmod;
026
027import java.util.HashMap;
028import java.util.Map;
029
030/**
031 *
032 * @author Jianjiong Gao
033 * @since 3.0
034 */
035public enum ModificationOccurrenceType {
036        NATURAL("natural"),
037        HYPOTHETICAL("hypothetical"),
038        ARTIFACTUAL("artifactual");
039
040        ModificationOccurrenceType(String label) {
041                this.label = label;
042        }
043
044        /**
045         *
046         * @return the label of this ModificationOccurrenceType.
047         */
048        public String label() {
049                return label;
050        }
051
052        /**
053         * @return the label of this ModificationOccurrenceType.
054         */
055        @Override
056        public String toString() {
057                return label;
058        }
059
060        /**
061         * The variable is the same as the &ltOccurrence> in the ptm_list XML file.
062         */
063        private String label;
064
065        /**
066         *
067         * @param label the label of ModificationOccurrenceType.
068         * @return the ModificationOccurrenceType that has the label.
069         */
070        public static ModificationOccurrenceType getByLabel(String label) {
071                return mapLabelOcc.get(label);
072        }
073
074        private static Map<String, ModificationOccurrenceType> mapLabelOcc;
075        static {
076                mapLabelOcc = new HashMap<String, ModificationOccurrenceType>();
077                for (ModificationOccurrenceType occ:ModificationOccurrenceType.values()) {
078                        mapLabelOcc.put(occ.label, occ);
079                }
080        }
081}