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;
023
024import org.biojava.utils.ChangeType;
025import org.biojava.utils.ChangeVetoException;
026import org.biojava.utils.Changeable;
027import org.biojavax.bio.seq.RichLocation;
028
029/**
030 * Represents a documentary reference. Relates to the bioentryreference table 
031 * in BioSQL.
032 * @author Richard Holland
033 * @see DocRef
034 * @author gwaldon
035 * @since 1.5
036 */
037public interface RankedDocRef extends Comparable,Changeable {
038    
039    public static final ChangeType RANK = new ChangeType(
040            "This ranked docreference's rank has changed",
041            "org.biojavax.RankedDocRef",
042            "RANK"
043            );
044    
045    public static final ChangeType LOCATION = new ChangeType(
046            "This ranked docreference's location has changed",
047            "org.biojavax.RankedDocRef",
048            "LOCATION"
049            );
050    
051    /**
052     * Represents a reference to a document. This value is intended to be set by 
053     * the constructor of the implementing class.
054     * @return the document reference.
055     */
056    public DocRef getDocumentReference();
057    
058    /**
059     * The start position in the sequence that this reference is referred to from.
060     * This value is intended to be set by the constructor of the implementing
061     * class. The position returned is from 1 to the length of the sequence.
062     * @return the start position.
063     */
064    public Integer getStart();
065    
066    /**
067     * The end position in the sequence that this reference is referred to from.
068     * This value is intended to be set by the constructor of the implementing
069     * class. The position returned is from 1 to the length of the sequence.
070     * @return the end position.
071     */
072    public Integer getEnd();
073    
074    /**
075     * If this object was constructed using a location instead of two integers,
076     * then this method will return that location. The getStart() and getEnd()
077     * methods will then return the min and max of that location, using the
078     * default location position resolver to resolve them to exact positions.
079     * If this object was constructed using two integers, then this method will
080     * return a simple location whose min and max correspond to those integers.
081     * @return the location of this reference on the sequence. 
082     */
083    public RichLocation getLocation();
084    
085    /**
086     * Set the location of this reference.
087     * @param location the location to use.
088     * @throws ChangeVetoException if the new location is unacceptable.
089     */
090    public void setLocation(RichLocation location) throws ChangeVetoException;
091
092    /**
093     * The rank of this reference. This value is intended to be set by the constructor
094     * of the implementing class.
095     * @return the rank.
096     */
097    public int getRank();
098    
099    /**
100     * Set the rank of this reference.
101     * @param rank the rank to use.
102     * @throws ChangeVetoException if the new rank is unacceptable.
103     */
104    public void setRank(int rank)  throws ChangeVetoException;
105}
106
107