Skip to main content

int_interval_stack/int_co_stack/
impls_for_access.rs

1use super::*;
2
3impl<I> IntCOStack<I>
4where
5    I: IntCO,
6{
7    #[inline]
8    pub fn change_points(&self) -> &[ChangePoint<I::CoordType>] {
9        &self.change_points
10    }
11
12    #[inline]
13    pub fn covered(&self) -> &IntCOSet<I> {
14        &self.covered
15    }
16
17    #[inline]
18    pub fn height_stats(&self) -> StackHeightStats {
19        self.height_stats
20    }
21
22    #[inline]
23    pub fn height_at(&self, x: I::CoordType) -> usize {
24        let i = self.change_points.partition_point(|p| p.at <= x);
25        if i == 0 {
26            0
27        } else {
28            self.change_points[i - 1].height_after
29        }
30    }
31}
32
33#[cfg(test)]
34mod tests_for_access;