|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.symbol.LocationTools
Tools class containing a number of operators for working with Location
objects.
Most of the methods in this class are simple set-wise binary operators: for example, calculate the intersection of two locations.
Method Summary | |
static boolean |
areEqual(Location locA,
Location locB)
Return whether two locations are equal. |
static boolean |
contains(Location locA,
Location locB)
Return true iff all indices in locB are also contained
by locA . |
static Location |
flip(Location loc,
int len)
Flips a location relative to a length. |
static Location |
intersection(Location locA,
Location locB)
Return the intersection of two locations. |
static CircularLocation |
makeCircularLocation(int min,
int max,
int seqLength)
A simple method to generate a RangeLocation wrapped in a CircularLocation. |
static Location |
makeLocation(int min,
int max)
Return a contiguous Location from min to max. |
static boolean |
overlaps(Location locA,
Location locB)
Determines whether the locations overlap or not. |
static Location |
subtract(Location x,
Location y)
Subtract one location from another. |
static Location |
union(java.util.Collection locs)
The n-way union of a Collection of locations. |
static Location |
union(Location locA,
Location locB)
Return the union of two locations. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Location union(Location locA, Location locB)
The union will be a Location instance that contains every index contained by either locA or locB.
locA
- the first LocationlocB
- the second Location
public static Location intersection(Location locA, Location locB)
The intersection will be a Location instance that contains every index contained by both locA and locB.
locA
- the first LocationlocB
- the second Location
public static boolean overlaps(Location locA, Location locB)
Two locations overlap if they contain at least one index in common.
locA
- the first LocationlocB
- the second Locationpublic static boolean contains(Location locA, Location locB)
true
iff all indices in locB
are also contained
by locA
.
locA
- The containing locationlocB
- The contained location
true
is locA contains locBpublic static boolean areEqual(Location locA, Location locB)
They are equal if both a contains b and b contains a. Equivalently, they are equal if for every point p, locA.contains(p) == locB.contains(p).
locA
- the first LocationlocB
- the second Location
public static Location union(java.util.Collection locs)
locs
locs
- A collection of locations.
java.lang.ClassCastException
- if the collection contains non-Location objects.public static Location makeLocation(int min, int max)
If min == max then a PointLocation will be made, otherwise, a RangeLocation will be returned.
min
- the Location min valuemax
- the Location max value
public static CircularLocation makeCircularLocation(int min, int max, int seqLength)
min
- the "left" end of the locationmax
- the "right" end of the locationseqLength
- the lenght of the sequence that the location will
be applied to (for purposes of determining origin).
java.lang.IllegalArgumentException
- if min, max, or seqLength are 0;public static Location flip(Location loc, int len)
It is very common in biological sequences to represent locations on a sequence and then reverse that sequence. This method allows locations in the original coordinate space to be transformed int locations in the reverse one.
loc
- the Location to fliplen
- the length of the region to flip within
public static Location subtract(Location x, Location y)
x
but not in y
.
x
- A locationy
- A location
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |