use crate::errors::ContextIndexError;
use crate::traits::contextuable::space_temporal::SpaceTemporal;
use crate::traits::contextuable::spatial::Spatial;
use crate::traits::contextuable::temporal::Temporal;
use crate::{Contextoid, ContextoidId, Datable, RelationKind, Symbolic};
#[allow(clippy::type_complexity)]
pub trait ContextuableGraph<D, S, T, ST, SYM, VS, VT>
where
D: Datable + Clone,
S: Spatial<VS> + Clone,
T: Temporal<VT> + Clone,
ST: SpaceTemporal<VS, VT> + Clone,
SYM: Symbolic + Clone,
VS: Clone,
VT: Clone,
{
fn add_node(
&mut self,
value: Contextoid<D, S, T, ST, SYM, VS, VT>,
) -> Result<usize, ContextIndexError>;
fn contains_node(&self, index: usize) -> bool;
fn get_node(&self, index: usize) -> Option<&Contextoid<D, S, T, ST, SYM, VS, VT>>;
fn remove_node(&mut self, node_id: ContextoidId) -> Result<(), ContextIndexError>;
fn update_node(
&mut self,
node_id: ContextoidId,
new_node: Contextoid<D, S, T, ST, SYM, VS, VT>,
) -> Result<(), ContextIndexError>;
fn add_edge(
&mut self,
a: usize,
b: usize,
weight: RelationKind,
) -> Result<(), ContextIndexError>;
fn contains_edge(&self, a: usize, b: usize) -> bool;
fn remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>;
fn size(&self) -> usize;
fn is_empty(&self) -> bool;
fn number_of_nodes(&self) -> usize;
fn number_of_edges(&self) -> usize;
}
#[allow(clippy::type_complexity)]
pub trait ExtendableContextuableGraph<D, S, T, ST, SYM, VS, VT>
where
D: Datable + Clone,
S: Spatial<VS> + Clone,
T: Temporal<VT> + Clone,
ST: SpaceTemporal<VS, VT> + Clone,
SYM: Symbolic + Clone,
VS: Clone,
VT: Clone,
{
fn extra_ctx_add_new(&mut self, capacity: usize, default: bool) -> u64;
fn extra_ctx_add_new_with_id(
&mut self,
id: u64,
capacity: usize,
default: bool,
) -> Result<(), ContextIndexError>;
fn extra_ctx_check_exists(&self, idx: u64) -> bool;
fn extra_ctx_get_current_id(&self) -> u64;
fn extra_ctx_set_current_id(&mut self, idx: u64) -> Result<(), ContextIndexError>;
fn extra_ctx_unset_current_id(&mut self) -> Result<(), ContextIndexError>;
fn extra_ctx_add_node(
&mut self,
value: Contextoid<D, S, T, ST, SYM, VS, VT>,
) -> Result<usize, ContextIndexError>;
fn extra_ctx_contains_node(&self, index: usize) -> bool;
fn extra_ctx_get_node(
&self,
index: usize,
) -> Result<&Contextoid<D, S, T, ST, SYM, VS, VT>, ContextIndexError>;
fn extra_ctx_remove_node(&mut self, index: usize) -> Result<(), ContextIndexError>;
fn extra_ctx_add_edge(
&mut self,
a: usize,
b: usize,
weight: RelationKind,
) -> Result<(), ContextIndexError>;
fn extra_ctx_contains_edge(&self, a: usize, b: usize) -> bool;
fn extra_ctx_remove_edge(&mut self, a: usize, b: usize) -> Result<(), ContextIndexError>;
fn extra_ctx_size(&self) -> Result<usize, ContextIndexError>;
fn extra_ctx_is_empty(&self) -> Result<bool, ContextIndexError>;
fn extra_ctx_node_count(&self) -> Result<usize, ContextIndexError>;
fn extra_ctx_edge_count(&self) -> Result<usize, ContextIndexError>;
}