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 01-21-2010
021 */
022
023package org.biojava.nbio.core.sequence.location;
024
025import org.biojava.nbio.core.sequence.Strand;
026import org.biojava.nbio.core.sequence.location.template.Location;
027import org.biojava.nbio.core.sequence.location.template.Point;
028import org.biojava.nbio.core.sequence.template.AbstractSequence;
029import org.biojava.nbio.core.sequence.template.Compound;
030
031import java.util.List;
032/**
033 * A location in a sequence that keeps a reference to its parent sequence
034 * @author Scooter Willis <willishf at gmail dot com>
035 * @author Paolo Pavan
036 */
037public class SequenceLocation<S extends AbstractSequence<C>, C extends Compound> extends SimpleLocation {
038        private S sequence;
039
040        public SequenceLocation(int start, int end,S sequence){
041                super(start,end);
042                this.sequence = sequence;
043
044        }
045
046
047        public SequenceLocation(int start, int end, S sequence, Strand strand, boolean circular, List<Location> subLocations) {
048                super(new SimplePoint(start), new SimplePoint(end), strand, circular, subLocations);
049
050                this.sequence = sequence;
051        }
052
053        public SequenceLocation(int start, int end,S sequence, Strand strand){
054                super(start,end);
055                this.sequence = sequence;
056                setStrand(strand);
057
058        }
059
060        public SequenceLocation(Point start, Point end, S sequence, Strand strand) {
061                super(start, end, strand);
062                this.sequence = sequence;
063                setStrand(strand);
064        }
065
066        /**
067         * @return the sequence
068         */
069        public S getSequence() {
070                return sequence;
071        }
072
073        public void setSequence(S sequence) {
074                this.sequence = sequence;
075        }
076}