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.bio.seq;
023
024/**
025 * Holds info about base positions.
026 * @author Richard Holland
027 * @since 1.5
028 */
029public interface Position {
030        
031    /**
032     * The empty position lies nowhere.
033     */
034    public static final Position EMPTY_POSITION = new SimplePosition(false,false,0);
035
036    /**
037     * A symbol representing a position that falls in between two bases,
038     * eg. 2^3 falls somewhere in the gap between 2 and 3.
039     */
040    public static final String BETWEEN_BASES = "^";
041    
042    /**
043     * A symbol representing a position that occupies a single base somewhere
044     * in a range, eg. 5.10 falls on some base between 5 and 10.
045     */
046    public static final String IN_RANGE = ".";
047    
048    /**
049     * Returns true if the position has a fuzzy start.
050     * @return the fuzziness of the start.
051     */
052    public boolean getFuzzyStart();    
053    
054    /**
055     * Returns true if the position has a fuzzy end.
056     * @return the fuzziness of the end.
057     */
058    public boolean getFuzzyEnd();
059    
060    /**
061     * Returns the beginning of the range of bases this base could lie in.
062     * If this position is a single position, then start=end.
063     * @return the start of this position.
064     */
065    public int getStart();  
066    
067    /**
068     * Returns the end of the range of bases this base could lie in.
069     * If this position is a single position, then start=end.
070     * @return the end of this position.
071     */
072    public int getEnd();
073    
074    /**
075     * Takes this position and returns a copy translated by 'distance' bases.
076     * @param distance the distance to translate it.
077     * @return the translated position.
078     */
079    public Position translate(int distance);
080    
081    /**
082     * Returns the type of this position if it is not a point/single position.
083     * Types are usually BETWEEN_BASES or IN_RANGE but could be any string value.
084     * @return the type of this position.
085     */
086    public String getType();
087}