Class FuzzyLocation
- java.lang.Object
-
- org.biojava.bio.symbol.AbstractLocation
-
- org.biojava.bio.symbol.AbstractRangeLocation
-
- org.biojava.bio.symbol.FuzzyLocation
-
- All Implemented Interfaces:
Serializable
,Location
public class FuzzyLocation extends AbstractRangeLocation implements Serializable
A 'fuzzy' location a-la Embl fuzzy locations.Fuzzy locations have propreties that indicate that they may start before min and end after max. However, this in no way affects how they interact with other locations.
- Author:
- Matthew Pocock, Thomas Down, Greg Cox
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FuzzyLocation.RangeResolver
Determines how aFuzzyLocation
should be treated when used as a normalLocation
.
-
Field Summary
Fields Modifier and Type Field Description static FuzzyLocation.RangeResolver
RESOLVE_AVERAGE
Use the arithmetic mean of the `inner' and `outer' values, unless the outer value is unbounded.static FuzzyLocation.RangeResolver
RESOLVE_INNER
Always use the `inner' values.static FuzzyLocation.RangeResolver
RESOLVE_OUTER
Use the `outer' values, unless they are unbounded in which case the `inner' values are used.-
Fields inherited from interface org.biojava.bio.symbol.Location
empty, full, naturalOrder
-
-
Constructor Summary
Constructors Constructor Description FuzzyLocation(int outerMin, int outerMax, int innerMin, int innerMax, boolean isMinFuzzy, boolean isMaxFuzzy, FuzzyLocation.RangeResolver resolver)
Create a new FuzzyLocation with endpoints (outerMin.innerMin) and (innerMax.outerMax).FuzzyLocation(int outerMin, int outerMax, int innerMin, int innerMax, FuzzyLocation.RangeResolver resolver)
Create a new FuzzyLocation with endpoints (outerMin.innerMin) and (innerMax.outerMax).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getInnerMax()
int
getInnerMin()
int
getMax()
The maximum position contained.int
getMin()
The minimum position contained.int
getOuterMax()
int
getOuterMin()
FuzzyLocation.RangeResolver
getResolver()
Retrieve the Location that this decorates.boolean
hasBoundedMax()
boolean
hasBoundedMin()
protected void
initializeVariables(int outerMin, int outerMax, int innerMin, int innerMax, boolean isMinFuzzy, boolean isMaxFuzzy, FuzzyLocation.RangeResolver resolver)
Refactored initialization code from the constructors.boolean
isMaxFuzzy()
boolean
isMinFuzzy()
String
toString()
Location
translate(int dist)
Create a location that is a translation of this location.-
Methods inherited from class org.biojava.bio.symbol.AbstractRangeLocation
blockIterator, contains, isContiguous, symbols
-
Methods inherited from class org.biojava.bio.symbol.AbstractLocation
contains, equals, getDecorator, hashCode, intersection, newInstance, overlaps, union
-
-
-
-
Field Detail
-
RESOLVE_INNER
public static final FuzzyLocation.RangeResolver RESOLVE_INNER
Always use the `inner' values.
-
RESOLVE_OUTER
public static final FuzzyLocation.RangeResolver RESOLVE_OUTER
Use the `outer' values, unless they are unbounded in which case the `inner' values are used.
-
RESOLVE_AVERAGE
public static final FuzzyLocation.RangeResolver RESOLVE_AVERAGE
Use the arithmetic mean of the `inner' and `outer' values, unless the outer value is unbounded.
-
-
Constructor Detail
-
FuzzyLocation
public FuzzyLocation(int outerMin, int outerMax, int innerMin, int innerMax, FuzzyLocation.RangeResolver resolver)
Create a new FuzzyLocation with endpoints (outerMin.innerMin) and (innerMax.outerMax).- Parameters:
outerMin
- the lower bound on the location's min value. Integer.MIN_VALUE indicates unbounded.outerMax
- the upper bound on the location's max value. Integer.MAX_VALUE indicates unbounded.innerMin
- the upper bound on the location's min value.innerMax
- the lower bound on the location's max value.resolver
- a RangeResolver object which defines the policy used to calculate the location's min and max properties.
-
FuzzyLocation
public FuzzyLocation(int outerMin, int outerMax, int innerMin, int innerMax, boolean isMinFuzzy, boolean isMaxFuzzy, FuzzyLocation.RangeResolver resolver)
Create a new FuzzyLocation with endpoints (outerMin.innerMin) and (innerMax.outerMax). This constructor allows you to explicitly mark an endpoint as fuzzy, even if there is no other information about it. For example, a valid swissprot location "?5 10" would be a fuzzy location 5 to 10 where the min is fuzzy and the max is not.Note that it is not logical to specify inner and outer values that clearly denote fuzzy boundaries and the set the
isMinFuzzy
orisMaxFuzzy
value to false. This object makes no specific check of your logic so be careful.- Parameters:
outerMin
- the lower bound on the location's min value. Integer.MIN_VALUE indicates unbounded.outerMax
- the upper bound on the location's max value. Integer.MAX_VALUE indicates unbounded.innerMin
- the upper bound on the location's min value.innerMax
- the lower bound on the location's max value.isMinFuzzy
- Explictly state if the minimum is fuzzyisMaxFuzzy
- Explictly state if the maximum is fuzzyresolver
- a RangeResolver object which defines the policy used to calculate the location's min and max properties.
-
-
Method Detail
-
translate
public Location translate(int dist)
Description copied from interface:Location
Create a location that is a translation of this location.
-
getResolver
public FuzzyLocation.RangeResolver getResolver()
Retrieve the Location that this decorates.- Returns:
- the Location instance that stores all of the Location interface data
-
getOuterMin
public int getOuterMin()
-
getOuterMax
public int getOuterMax()
-
getInnerMin
public int getInnerMin()
-
getInnerMax
public int getInnerMax()
-
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
-
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
-
hasBoundedMin
public boolean hasBoundedMin()
-
hasBoundedMax
public boolean hasBoundedMax()
-
isMinFuzzy
public boolean isMinFuzzy()
-
isMaxFuzzy
public boolean isMaxFuzzy()
-
initializeVariables
protected void initializeVariables(int outerMin, int outerMax, int innerMin, int innerMax, boolean isMinFuzzy, boolean isMaxFuzzy, FuzzyLocation.RangeResolver resolver)
Refactored initialization code from the constructors.- Parameters:
outerMin
- the lower bound on the location's min value. Integer.MIN_VALUE indicates unbounded.outerMax
- the upper bound on the location's max value. Integer.MAX_VALUE indicates unbounded.innerMin
- the upper bound on the location's min value.innerMax
- the lower bound on the location's max value.resolver
- a RangeResolver object which defines the policy used to calculate the location's min and max properties.
-
-