1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// SPDX-License-Identifier: MIT
// Copyright (c) "2023" . Marvin Hansen <marvin.hansen@gmail.com> All rights reserved.

use ultragraph::prelude::*;

use crate::prelude::{
    ContextIndexError, Contextoid, ContextuableGraph, Datable,
    RelationKind, SpaceTemporal, Spatial, Temporal,
};

mod debug;
mod identifiable;
mod contextuable_graph;

pub struct Context<'l, D, S, T, ST>
    where
        D: Datable,
        S: Spatial,
        T: Temporal,
        ST: SpaceTemporal,
{
    id: u64,
    name: &'l str,
    graph: UltraGraph<Contextoid<D, S, T, ST>>,
}


impl<'l, D, S, T, ST> Context<'l, D, S, T, ST>
    where
        D: Datable,
        S: Spatial,
        T: Temporal,
        ST: SpaceTemporal,
{
    /// Creates a new context with the given node capacity.
    pub fn with_capacity(
        id: u64,
        name: &'l str,
        capacity: usize,
    )
        -> Self
    {
        Self {
            id,
            name,
            graph: ultragraph::new_with_matrix_storage(capacity),
        }
    }

    /// Returns the name of the context.
    pub fn name(&self) -> &str {
        self.name
    }
}