use std::fmt::Display;
/// sh:maxCount specifies the maximum number of value nodes that satisfy the
/// condition.
///
/// - IRI: https://www.w3.org/TR/shacl/#MaxCountConstraintComponent
/// - DEF: If the number of value nodes is greater than $maxCount, there is a
/// validation result.
#[derive(Debug, Clone)]
pub struct MaxCount {
max_count: usize,
}
impl MaxCount {
pub fn new(max_count: isize) -> Self {
MaxCount {
max_count: max_count as usize,
}
}
pub fn max_count(&self) -> usize {
self.max_count
}
}
impl Display for MaxCount {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MaxCount: {}", self.max_count())
}
}