use crate::{grouping::area::Area, parameters::SubspaceId};
pub struct AreaOfInterest<const MCL: usize, const MCC: usize, const MPL: usize, S: SubspaceId> {
pub area: Area<MCL, MCC, MPL, S>,
pub max_count: u64,
pub max_size: u64,
}
impl<const MCL: usize, const MCC: usize, const MPL: usize, S: SubspaceId>
AreaOfInterest<MCL, MCC, MPL, S>
{
pub fn intersection(
&self,
other: AreaOfInterest<MCL, MCC, MPL, S>,
) -> Option<AreaOfInterest<MCL, MCC, MPL, S>> {
match self.area.intersection(&other.area) {
None => None,
Some(area_intersection) => Some(Self {
area: area_intersection,
max_count: core::cmp::min(self.max_count, other.max_count),
max_size: self.max_size.min(other.max_size),
}),
}
}
}