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    package org.biojava3.core.sequence.location;
023    
024    import java.util.Arrays;
025    import java.util.Collections;
026    import java.util.List;
027    import org.biojava3.core.sequence.AccessionID;
028    
029    import org.biojava3.core.sequence.Strand;
030    import org.biojava3.core.sequence.location.template.AbstractLocation;
031    import org.biojava3.core.sequence.location.template.Location;
032    import org.biojava3.core.sequence.location.template.Point;
033    
034    /**
035     * Very basic implementation of the Location interface which defines a series
036     * of simple constructors.
037     *
038     * @author ayates
039     */
040    public class SimpleLocation extends AbstractLocation {
041    
042        private static final List<Location> EMPTY_LOCS = Collections.emptyList();
043    
044        public SimpleLocation(int start, int end) {
045            this(new SimplePoint(start), new SimplePoint(end));
046        }
047    
048        public SimpleLocation(Point start, Point end) {
049            this(start, end, Strand.POSITIVE);
050        }
051    
052        public SimpleLocation(int start, int end, Strand strand) {
053            this(new SimplePoint(start), new SimplePoint(end), strand);
054        }
055    
056        public SimpleLocation(Point start, Point end, Strand strand) {
057            super(start, end, strand, false, false, EMPTY_LOCS);
058        }
059    
060        public SimpleLocation(Point start, Point end, Strand strand, AccessionID accession) {
061            super(start, end, strand, false, false, accession, EMPTY_LOCS);
062        }
063    
064        public SimpleLocation(Point start, Point end, Strand strand, boolean betweenCompounds, AccessionID accession) {
065            super(start, end, strand, false, betweenCompounds, accession, EMPTY_LOCS);
066        }
067    
068        public SimpleLocation(Point start, Point end, Strand strand, boolean circular, boolean betweenBases) {
069            super(start, end, strand, circular, betweenBases, EMPTY_LOCS);
070        }
071    
072        public SimpleLocation(int start, int end, Strand strand, Location... subLocations) {
073            this(new SimplePoint(start), new SimplePoint(end), strand, subLocations);
074        }
075    
076        public SimpleLocation(Point start, Point end, Strand strand, Location... subLocations) {
077            super(start, end, strand, false, false, Arrays.asList(subLocations));
078        }
079    
080        public SimpleLocation(Point start, Point end, Strand strand, boolean circular, Location... subLocations) {
081            super(start, end, strand, circular, false, Arrays.asList(subLocations));
082        }
083    
084        public SimpleLocation(Point start, Point end, Strand strand, boolean circular, List<Location> subLocations) {
085            super(start, end, strand, circular, false, subLocations);
086        }
087    
088        public SimpleLocation(Point start, Point end, Strand strand, boolean circular, boolean betweenBases, List<Location> subLocations) {
089            super(start, end, strand, circular, betweenBases, subLocations);
090        }    
091    }