iPE::Util::Interval(3)

NAME
iPE::Util::Interval - An interval relative to either end of a set, such as a feature or set of features.

DESCRIPTION
This object allows the "L" and "N" notation in the parameter template file and translates them to real life coordinates. For example, if a model within a state feature occurs from positions 0 to 10, this will translate to the beginning coordinate of the feature and the 10th coordinate of the feature. This can also be relative to the end of the feature, such as "L-10" and "L-1," which would translate to the 10th to last and last coordinate of the feature.

This object also allows the interval (.,.), the default interval for all undefined regions, but will not allow only one "." and a number.

FUNCTIONS

new (memberHash)
    Creates a new interval. Requires the following keys defined in the member hash reference:

    low The low coordinate of the interval

    high
        The high coordinate of the interval

    letter
        The letter that denotes the last coordinate or element in the set, for example "L" or "N."

    object (optional)
        Pass in an object to associate with the interval, in case you wish to recover it, for example, in an iPE::Util::Overlap grouping.

    Returns undef if the interval is poorly formed.

clone ()
    Return a new copy of the calling object

  high (), low (), letter (), object ()
These are accessor functions which should exactly return the paramters you passed to new ().

format ()
    Format an interval for outputting.

translate (low, high)
    Translates the interval from the abstract interval defined by this object to a concrete interval by the given coordinates. For example, if the Interval object object was construted with 1 and L-1, the interval 100 to 110 would translate to (101, 109). This function returns an array comprised of the low and high coordinates in that order.

length ()
    If both the high and low ends of the interval were defined by the beginning or end of the parent region, then the length of the interval is fixed. If this is the case, you may call this function to get the length of the interval. If they were not, a warning is displayed and undef is returned.

cmp (a, b)
    Compares two intervals. This is useful for sorting, where you can put { $a->cmp->($b) } as the compare function

NON-OBJECT METHODS
These methods are not object methods, and are exported. No calling object is expected.

includes (low, high, num)
    This function determins if the number num is contained in the new interval.

    Note that you can pass a translated value to this function:

    $interval->includes($interval->translate($begin, $end), $val);

intersection (lowA, highA, lowB, highB)
    Find the intersection between the two intervals. The result is returned in an array, and if there is no intersection, the returned array is empty.

    Note that you can pass a translated value to this function:

    $interval->includes($interval->translate($begin, $end), $low, $high);

SEE ALSO

AUTHOR
Bob Zimmermann (rpz@cse.wustl.edu).

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 96:
    You forgot a '=back' before '=head2'

Around line 107:
    '=item' outside of any '=over'