rangex v0.1.0 Rangex.Range protocol

Common range calculations

Link to this section Summary

Functions

the first range and the second one have a common [point] boundary

two ranges that do not share an intersection range

extracts the from component

The first range includes the second completely

Merges the first and the second range, if they are mergeable

same as &extend/2 but throws if the range cannot be extended

returns true if two ranges are mergeable, false otherwhise Ths prevents joining of ranges which would otherwhise be adiacent or overlapping returns false in case of non-sdiacent and non-overlapping ranges

creates a new rtange objexct from from and to

two ranges that do share a intersection range

extracts the to component

Link to this section Types

Link to this section Functions

Link to this function adiacent?(range1, range2)

the first range and the second one have a common [point] boundary

Link to this function disjunct?(first, secons)

two ranges that do not share an intersection range

extracts the from component

Link to this function includes?(includes, included)

The first range includes the second completely

Link to this function merge(range1, range2)

Merges the first and the second range, if they are mergeable.

This has the implicit meaning that this holds: (overlap(range1,range2) or adiacent(range1,range2)) == true).

&mergeable?/2 Ranges will be merged by

  • combining from/to to their respective min/max
  • combining other data of both Range objects into one

Returns either {:ok, Range.t} or :error if the two are not mergeable

Link to this function merge!(range1, range2)

same as &extend/2 but throws if the range cannot be extended

Link to this function mergeable?(range1, range2)

returns true if two ranges are mergeable, false otherwhise Ths prevents joining of ranges which would otherwhise be adiacent or overlapping returns false in case of non-sdiacent and non-overlapping ranges

Link to this function new(model, from, to)

creates a new rtange objexct from from and to

Link to this function overlaps?(first, second)

two ranges that do share a intersection range

extracts the to component