use super::{GraphDiagnostic, GraphEdge, GraphNode, GraphNodeId};
use std::collections::BTreeMap;
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct GraphSnapshot {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
pub diagnostics: Vec<GraphDiagnostic>,
pub package_membership: BTreeMap<GraphNodeId, GraphNodeId>,
}
impl GraphSnapshot {
pub fn new() -> Self {
Self::default()
}
pub fn node_count(&self) -> usize {
self.nodes.len()
}
pub fn edge_count(&self) -> usize {
self.edges.len()
}
pub fn diagnostic_count(&self) -> usize {
self.diagnostics.len()
}
pub fn add_node(&mut self, node: GraphNode) {
self.nodes.push(node);
}
pub fn add_edge(&mut self, edge: GraphEdge) {
self.edges.push(edge);
}
pub fn add_diagnostic(&mut self, diagnostic: GraphDiagnostic) {
self.diagnostics.push(diagnostic);
}
}