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 */
021
022package org.biojavax.ontology;
023
024import org.biojava.ontology.Term;
025import org.biojava.utils.ChangeType;
026import org.biojava.utils.ChangeVetoException;
027import org.biojava.utils.Changeable;
028import org.biojavax.RankedCrossRefable;
029
030/**
031 * Makes Term objects comparable properly and adds some extra features to them.
032 * @author Richard Holland
033 * @since 1.5
034 */
035public interface ComparableTerm extends Term,RankedCrossRefable,Comparable,Changeable {
036    
037    public static final ChangeType IDENTIFIER = new ChangeType(
038            "This term's identifier has changed",
039            "org.biojavax.ontology.ComparableTerm",
040            "IDENTIFIER"
041            );
042    public static final ChangeType OBSOLETE = new ChangeType(
043            "This term's obsolescence has changed",
044            "org.biojavax.ontology.ComparableTerm",
045            "OBSOLETE"
046            );
047    public static final ChangeType DESCRIPTION = new ChangeType(
048            "This term's description has changed",
049            "org.biojavax.ontology.ComparableTerm",
050            "DESCRIPTION"
051            );
052    public static final ChangeType RANKEDCROSSREF = new ChangeType(
053            "This term's ranked crossrefs have changed",
054            "org.biojavax.ontology.ComparableTerm",
055            "RANKEDCROSSREF"
056            );
057    
058    /**
059     * Returns the (optional) identifier associated with this term.
060     * @return the string identifier.
061     */
062    public String getIdentifier();
063    
064    /**
065     * Sets the (optional) identifier associated with this term.
066     * @param identifier the identifier to give the term. Null will unset it.
067     * @throws ChangeVetoException if the identifier is unacceptable.
068     */
069    public void setIdentifier(String identifier) throws ChangeVetoException;
070    
071    /**
072     * Checks to see if this term is obsolete. As the column in the database
073     * is nullable, this value is a Boolean object instead of a boolean simple
074     * type. Hence it may also be null.
075     * @return true if it is, false if not.
076     */
077    public Boolean getObsolete();
078    
079    /**
080     * Sets the obsolescence flag associated with this term.
081     * @param obsolete true if it is obsolete, false if not. Nullable.
082     * @throws ChangeVetoException if the change is unacceptable.
083     */
084    public void setObsolete(Boolean obsolete) throws ChangeVetoException;
085    
086    /**
087     * Sets the description associated with this term.
088     * @param description the description to give the term. Nullable.
089     * @throws ChangeVetoException if the description is unacceptable.
090     */
091    public void setDescription(String description) throws ChangeVetoException;
092    
093}