Class 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
    • 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 or isMaxFuzzy 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 fuzzy
        isMaxFuzzy - Explictly state if the maximum is fuzzy
        resolver - 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.
        Specified by:
        translate in interface Location
        Parameters:
        dist - the distance to translate (to the right)
      • getMin

        public int getMin()
        Description copied from interface: Location
        The minimum position contained.

        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

        Specified by:
        getMin in interface Location
        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() 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

        Specified by:
        getMax in interface Location
        Returns:
        the maximum position contained
      • 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.