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 Jan 24, 2008
021 *
022 */
023
024package org.biojava.nbio.ontology;
025
026import java.util.Comparator;
027
028
029public class Synonym implements Comparable<Synonym>{
030
031
032        public final static int UNKNOWN_SCOPE = -1;
033        public final static int RELATED_SYNONYM = 0;
034        public final static int EXACT_SYNONYM = 1;
035        public final static int NARROW_SYNONYM = 2;
036        public final static int BROAD_SYNONYM = 3;
037
038        int scope;
039        String category;
040        String name;
041
042        @Override
043        public String toString(){
044                String txt = "Synonym: name:"+name+ " category:" + category + " scope: " +scope;
045                return txt;
046        }
047
048        public final static Comparator<Synonym> COMPARATOR = new Comparator<Synonym>() {
049                @Override
050                public int compare(Synonym a, Synonym b) {
051                        return String.CASE_INSENSITIVE_ORDER.compare(a.toString(), b.toString());
052                }
053        };
054
055        public Synonym() {
056        }
057        public String getName() {
058                return name;
059        }
060        public void setName(String name) {
061                this.name = name;
062        }
063        public String getCategory() {
064                return category;
065        }
066        public void setCategory(String category) {
067                this.category = category;
068        }
069        public int getScope() {
070                return scope;
071        }
072        public void setScope(int scope) {
073                this.scope = scope;
074        }
075        @Override
076        public int compareTo(Synonym o) {
077                return COMPARATOR.compare(this, o);
078        }
079}