public class CircularLocation extends AbstractLocationDecorator
Note also that as a location that overlaps the origin is a compound location it's min will be 1 and its max will be length (by default). In these cases it is imperative to use the block iterator if you wish to know the 'true' min and max (bearing in mind that there is no logical value for a min or max on a circular sequence).
The symbols() method has been overridden to handle the weirdness of a location crossing the origin.
empty, full, naturalOrder
Constructor and Description |
---|
CircularLocation(Location wrapped,
int length)
Constructs a CircularLocation by wrapping another Location
It is preferable to use LocationTools to make CircularLocations
|
CircularLocation(Location wrapped,
int length,
int fivePrimeEnd)
Makes a CircularLocation where the 5' end of the Location is specified.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int p)
Checks if this location contains a point.
|
boolean |
contains(Location l)
Checks if this location contains the other.
|
protected Location |
decorate(Location loc) |
boolean |
equals(Object o)
Checks if this location is equivalent to the other.
|
ListIterator |
fivePrimeBlockIterator()
Iterates over the location blocks in order starting with the most 5'
|
int |
get3PrimeEnd() |
int |
get5PrimeEnd()
The point at which indicates the 5' end of the Location.
|
int |
getLength() |
int |
getMax()
This will give you the coordinate of the maximum point contained by this
Location.
|
int |
getMin()
This will give you the coordinate of the minimum point contained by this
Location.
|
Location |
intersection(Location l)
Returns a Location that contains all points common to both ranges.
|
boolean |
isContiguous()
Delegates to the wrapped location.
|
boolean |
overlaps(Location l)
Checks if these two locations overlap, using this location's
concept of overlapping.
|
boolean |
overlapsOrigin()
Does the Location overlap the origin (position 1) of the sequence?
|
SymbolList |
symbols(SymbolList seq)
Return the symbols in a sequence that fall within this range.
|
String |
toString() |
Location |
union(Location l)
Return a Location containing all points in either ranges.
|
blockIterator, getDecorator, getWrapped, newInstance, translate
public CircularLocation(Location wrapped, int length)
wrapped
- the Location to wrap.length
- the length of the Sequencepublic CircularLocation(Location wrapped, int length, int fivePrimeEnd)
fivePrimeEnd
parameter must match one of the minimum coordinates
of the wrapped Location
. This allows the creation of Locations
whose polarity can be specified. This method is used internally by LocationTools.union()
and by the other constructor.wrapped
- the Location
to map to a Circlelength
- the lenght of the circlefivePrimeEnd
- the 5' polar end of the sequenceIllegalArgumentException
- if the 5' end doesn't match the min coordinate
of either wrapped
or one of its blocks.public final int getLength()
public boolean overlapsOrigin()
If it does the Location will internally be composed of a CompoundLocation.
protected Location decorate(Location loc)
decorate
in class AbstractLocationDecorator
public boolean contains(int p)
Location
contains
in interface Location
contains
in class AbstractLocationDecorator
p
- the point to checkpublic Location intersection(Location l)
Location
intersection
in interface Location
intersection
in class AbstractLocationDecorator
l
- the Location to intersect withpublic boolean overlaps(Location l)
Location
Abstractly, two locations overlap if they both contain any point.
overlaps
in interface Location
overlaps
in class AbstractLocationDecorator
l
- the Location to checkpublic Location union(Location l)
Location
union
in interface Location
union
in class AbstractLocationDecorator
l
- the Location to union withpublic boolean contains(Location l)
Location
Abstractly, a location contains another if every point in the other location is contained within this one.
contains
in interface Location
contains
in class AbstractLocationDecorator
l
- the Location to checkpublic boolean equals(Object o)
Location
Abstractly, a location is equal to another if for every point in one it is also in the other. This is equivalent to a.contains(b) && b.contains(a). You should call LocationTools.areEqual after casting l to Location.
equals
in interface Location
equals
in class AbstractLocationDecorator
o
- the Object to checkpublic boolean isContiguous()
isContiguous
in interface Location
isContiguous
in class AbstractLocationDecorator
public int get5PrimeEnd()
getMin()
fivePrimeBlockIterator()
,
getMin()
,
get3PrimeEnd()
public int get3PrimeEnd()
fivePrimeBlockIterator()
,
getMax()
,
get5PrimeEnd()
public int getMin()
get5PrimeEnd()
getMin
in interface Location
getMin
in class AbstractLocationDecorator
get5PrimeEnd()
public int getMax()
getLength()
.
If you want to be guarenteed of getting
the rightmost coordinate then call get3PrimeEnd()
getMax
in interface Location
getMax
in class AbstractLocationDecorator
get3PrimeEnd()
public SymbolList symbols(SymbolList seq)
Location
symbols
in interface Location
symbols
in class AbstractLocationDecorator
seq
- the SymbolList to processpublic ListIterator fivePrimeBlockIterator()
AbstractLocationDecorator.blockIterator()
,
get5PrimeEnd()
Copyright © 2014 BioJava. All rights reserved.