Class FuzzyPointLocation
- java.lang.Object
-
- org.biojava.bio.symbol.AbstractLocation
-
- org.biojava.bio.symbol.FuzzyPointLocation
-
- All Implemented Interfaces:
Serializable
,Location
public class FuzzyPointLocation extends AbstractLocation
FuzzyPointLocation
represents two types of EMBL-style partially-defined locations. These are the '(123.567)' type, which represent a single residue somewhere between these coordinates and the '<123' or '>123' type, which represent an unbounded location, not including the residue at that coordinate.- Author:
- Keith James, Greg Cox
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FuzzyPointLocation.PointResolver
Determines how aFuzzyPointLocation
should be treated when used as a normalLocation
.
-
Field Summary
Fields Modifier and Type Field Description static FuzzyPointLocation.PointResolver
RESOLVE_AVERAGE
static FuzzyPointLocation.PointResolver
RESOLVE_MAX
static FuzzyPointLocation.PointResolver
RESOLVE_MIN
-
Fields inherited from interface org.biojava.bio.symbol.Location
empty, full, naturalOrder
-
-
Constructor Summary
Constructors Constructor Description FuzzyPointLocation(int min, int max, FuzzyPointLocation.PointResolver resolver)
Creates a newFuzzyPointLocation
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator
blockIterator()
Return an Iterator over the set of maximal contiguous sub-locations.boolean
contains(int point)
Checks if this location contains a point.boolean
contains(Location loc)
Checks if this location contains the other.boolean
equals(Location loc)
int
getMax()
The maximum position contained.int
getMin()
The minimum position contained.FuzzyPointLocation.PointResolver
getResolver()
boolean
hasBoundedMax()
boolean
hasBoundedMin()
int
hashCode()
Location
intersection(Location loc)
Returns a Location that contains all points common to both ranges.boolean
isContiguous()
Determine if a Location is contiguous.boolean
overlaps(Location loc)
Checks if these two locations overlap, using this location's concept of overlapping.SymbolList
symbols(SymbolList slist)
Return the symbols in a sequence that fall within this range.String
toString()
Location
translate(int dist)
Create a location that is a translation of this location.-
Methods inherited from class org.biojava.bio.symbol.AbstractLocation
equals, getDecorator, newInstance, union
-
-
-
-
Field Detail
-
RESOLVE_MIN
public static final FuzzyPointLocation.PointResolver RESOLVE_MIN
-
RESOLVE_MAX
public static final FuzzyPointLocation.PointResolver RESOLVE_MAX
-
RESOLVE_AVERAGE
public static final FuzzyPointLocation.PointResolver RESOLVE_AVERAGE
-
-
Constructor Detail
-
FuzzyPointLocation
public FuzzyPointLocation(int min, int max, FuzzyPointLocation.PointResolver resolver)
Creates a newFuzzyPointLocation
object. If the minimum value is equal to the maximum value, it is interperted as a swissprot point location such as "?24". If the minimum is Integer.MIN_VALUE and the maximum is Integer.MAX_VALUE, it is interperted as a swissprot location like '?'.- Parameters:
min
- anint
value for the minimum boundary of the location, Integer.MIN_VALUE if unbounded.max
- anint
value for the minimum boundary of the location, Integer.MAX_VALUE if unbounded.resolver
- aPointResolver
which defines the policy used to calculate the location's min and max properties.
-
-
Method Detail
-
getResolver
public FuzzyPointLocation.PointResolver getResolver()
-
getMin
public int getMin()
Description copied from interface:Location
The minimum position contained.WARNING: The location will not contain every point between
getMin()
andgetMax()
ifisContiguous()
is false. IfisContiguous()
does return false you should use theIterator
returned byblockIterator()
to iterate over the minimum set of contiguous blocks that make up thisLocation
- Returns:
- the minimum position contained
-
getMax
public int getMax()
Description copied from interface:Location
The maximum position contained.WARNING: The location will not contain every point between
getMin()
andgetMax()
ifisContiguous()
is false. IfisContiguous()
does return false you should use theIterator
returned byblockIterator()
to iterate over the minimum set of contiguous blocks that make up thisLocation
- Returns:
- the maximum position contained
-
hasBoundedMin
public boolean hasBoundedMin()
-
hasBoundedMax
public boolean hasBoundedMax()
-
overlaps
public boolean overlaps(Location loc)
Description copied from interface:Location
Checks if these two locations overlap, using this location's concept of overlapping.Abstractly, two locations overlap if they both contain any point.
- Specified by:
overlaps
in interfaceLocation
- Overrides:
overlaps
in classAbstractLocation
- Parameters:
loc
- the Location to check- Returns:
- true if they overlap, otherwise false
-
contains
public boolean contains(Location loc)
Description copied from interface:Location
Checks if this location contains the other.Abstractly, a location contains another if every point in the other location is contained within this one.
- Specified by:
contains
in interfaceLocation
- Overrides:
contains
in classAbstractLocation
- Parameters:
loc
- the Location to check- Returns:
- true if this contains l, otherwise false
-
contains
public boolean contains(int point)
Description copied from interface:Location
Checks if this location contains a point.- Parameters:
point
- the point to check- Returns:
- true if this contains p, otherwise false
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractLocation
-
intersection
public Location intersection(Location loc)
Description copied from interface:Location
Returns a Location that contains all points common to both ranges.- Specified by:
intersection
in interfaceLocation
- Overrides:
intersection
in classAbstractLocation
- Parameters:
loc
- the Location to intersect with- Returns:
- a Location containing all points common to both, or the empty range if there are no such points
-
symbols
public SymbolList symbols(SymbolList slist)
Description copied from interface:Location
Return the symbols in a sequence that fall within this range.- Parameters:
slist
- the SymbolList to process- Returns:
- the SymbolList containing the symbols in seq in this range
-
isContiguous
public boolean isContiguous()
Description copied from interface:Location
Determine if a Location is contiguous.- Returns:
true
if and only if this Location contains every point frommin
tomax
inclusive.
-
blockIterator
public Iterator blockIterator()
Description copied from interface:Location
Return an Iterator over the set of maximal contiguous sub-locations.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.
- Returns:
- an Iterator over Location objects that are the maximally contiguous set of locations contained within this location
-
translate
public Location translate(int dist)
Description copied from interface:Location
Create a location that is a translation of this location.- Parameters:
dist
- the distance to translate (to the right)
-
-