|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.symbol.AbstractLocationDecorator
public abstract class AbstractLocationDecorator
Abstract Location
decorator (wrapper).
These wrap up a normal Location
object, and act as markers to indicate that
the location has some kind of special semantics.
Field Summary |
---|
Fields inherited from interface org.biojava.bio.symbol.Location |
---|
empty, full, naturalOrder |
Constructor Summary | |
---|---|
protected |
AbstractLocationDecorator(Location wrapped)
Construct a new decorator wrapping the specified Location. |
Method Summary | |
---|---|
java.util.Iterator |
blockIterator()
Return an Iterator over the set of maximal contiguous sub-locations. |
boolean |
contains(int p)
Checks if this location contains a point. |
boolean |
contains(Location l)
Checks if this location contains the other. |
protected abstract Location |
decorate(Location loc)
|
boolean |
equals(java.lang.Object o)
Checks if this location is equivalent to the other. |
Location |
getDecorator(java.lang.Class decoratorClass)
Checks the decorator chain for an instance of |
int |
getMax()
The maximum position contained. |
int |
getMin()
The minimum position contained. |
protected Location |
getWrapped()
|
Location |
intersection(Location l)
Returns a Location that contains all points common to both ranges. |
boolean |
isContiguous()
Determine if a Location is contiguous. |
Location |
newInstance(Location loc)
Create a new instance of Location with all of the same decorators as this instance but with the data stored in loc . |
boolean |
overlaps(Location l)
Checks if these two locations overlap, using this location's concept of overlapping. |
SymbolList |
symbols(SymbolList seq)
Return the symbols in a sequence that fall within this range. |
Location |
translate(int dist)
Create a location that is a translation of this location. |
Location |
union(Location l)
Return a Location containing all points in either ranges. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractLocationDecorator(Location wrapped)
Method Detail |
---|
protected final Location getWrapped()
protected abstract Location decorate(Location loc)
public Location newInstance(Location loc)
Location
loc
.
The default behavior is to return loc
.
newInstance
in interface Location
loc
- the Location to use as template
public Location getDecorator(java.lang.Class decoratorClass)
Location
The default behavior is to return null. If the current object is a
decorator and is an instance of
getDecorator
in interface Location
decoratorClass
- the Class to check
public int getMin()
Location
WARNING: The location will not contain every point between getMin()
and getMax()
if isContiguous()
is false. If isContiguous()
does return false you should use the Iterator
returned by blockIterator()
to iterate over the minimum set of contiguous blocks that make up this Location
getMin
in interface Location
public int getMax()
Location
WARNING: The location will not contain every point between getMin()
and getMax()
if isContiguous()
is false. If isContiguous()
does return false you should use the Iterator
returned by blockIterator()
to iterate over the minimum set of contiguous blocks that make up this Location
getMax
in interface Location
public boolean overlaps(Location l)
Location
Abstractly, two locations overlap if they both contain any point.
overlaps
in interface Location
l
- the Location to check
public 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
l
- the Location to check
public boolean contains(int p)
Location
contains
in interface Location
p
- the point to check
public boolean equals(java.lang.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 java.lang.Object
o
- the Object to check
public Location intersection(Location l)
Location
intersection
in interface Location
l
- the Location to intersect with
public Location union(Location l)
Location
union
in interface Location
l
- the Location to union with
public SymbolList symbols(SymbolList seq)
Location
symbols
in interface Location
seq
- the SymbolList to process
public Location translate(int dist)
Location
translate
in interface Location
dist
- the distance to translate (to the right)public boolean isContiguous()
Location
isContiguous
in interface Location
true
if and only if this Location
contains every point from min
to
max
inclusive.public java.util.Iterator blockIterator()
Location
Given any location, it can be considered to contain zero or more maximal contiguous blocks of width 1 or greater. The empty location is composed from nothing. A contiguous location is composed from itself. A non-contiguous location is composed from contiguous blocks seperated by gaps.
This method should return an Iterator over these maximally contiguous blocks starting with the left-most block, and finishing at the right-most block.
blockIterator
in interface Location
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |