#[derive(Debug, Clone, PartialEq)]
pub struct DuplicateCluster {
pub id: usize,
pub indices: Vec<usize>,
pub representative: usize,
}
impl DuplicateCluster {
pub fn new(id: usize, representative: usize) -> Self {
Self {
id,
indices: vec![representative],
representative,
}
}
pub fn add(&mut self, index: usize) {
self.indices.push(index);
}
#[must_use]
pub fn len(&self) -> usize {
self.indices.len()
}
#[must_use]
pub fn is_empty(&self) -> bool {
self.indices.is_empty()
}
#[must_use]
pub fn is_duplicate(&self) -> bool {
self.len() > 1
}
#[must_use]
pub fn contains(&self, index: usize) -> bool {
self.indices.contains(&index)
}
}