pub struct IntervalSeq<T: Debug + Display + Clone + Hash + Eq + Ord + PartialEq + PartialOrd> { /* private fields */ }
Expand description
A structure that represents an interval sequence (a sequence of multiple Intervals).
Implementations§
Source§impl<T: Debug + Display + Clone + Hash + Eq + Ord + PartialEq + PartialOrd> IntervalSeq<T>
impl<T: Debug + Display + Clone + Hash + Eq + Ord + PartialEq + PartialOrd> IntervalSeq<T>
Sourcepub fn append(&mut self, value: &Interval<T>)
pub fn append(&mut self, value: &Interval<T>)
Add an interval element to this interval sequence.
- value: an interval
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Return whether the interval sequence are empty.
return: true if the interval sequence are empty
pub fn new(values: impl IntoIterator<Item = Interval<T>>) -> Self
Sourcepub fn extent(&self) -> Interval<T>
pub fn extent(&self) -> Interval<T>
Return the smallest interval that encompasses all the element intervals.
- return: the smallest interval that encompasses all the elemental intervals.
- panic: if none of the elements are present
Sourcepub fn gap(&self) -> Self
pub fn gap(&self) -> Self
In the sorted intervals, return the intervals that are between adjacent intervals as the interval sequence.
If the number of intervals is less than two, an empty sequence of intervals is returned. If the intervals overlap or touch each other, the intervals are not included in the result element. If all the intervals overlap, an empty interval sequence is returned.
- return: gap interval sequence
Sourcepub fn intersections(&self) -> Self
pub fn intersections(&self) -> Self
Return the sorted intervals where adjacent intervals overlap each other as an interval sequence.
If the number of intervals is less than two, an empty sequence of intervals is returned. If the intervals do not overlap or are tangent to each other, the intervals are not included in the result element. If all the intervals do not overlap, an empty interval sequence is returned.
- return: common interval sequence
Sourcepub fn iter(&mut self) -> impl Iterator<Item = &Interval<T>>
pub fn iter(&mut self) -> impl Iterator<Item = &Interval<T>>
Gets an iterator of this interval sequence.
Sourcepub fn into_iter(self) -> impl IntoIterator<Item = Interval<T>>
pub fn into_iter(self) -> impl IntoIterator<Item = Interval<T>>
Gets an into iterator of this interval sequence.