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