Skip to content

exchanges

interface_context_collector 🔗

interface_context_collector(
    diagram: InterfaceContextDiagram,
) -> cabc.Iterator[m.ModelElement]

Return the elements of the InterfaceContextDiagram.

Source code in src/capellambse_context_diagrams/collectors/exchanges.py
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
def interface_context_collector(
    diagram: context.InterfaceContextDiagram,
) -> cabc.Iterator[m.ModelElement]:
    """Return the elements of the InterfaceContextDiagram."""
    if (
        not isinstance(diagram.target, cs.PhysicalLink)
        and not diagram._hide_functions
    ):
        intermap: dict[DT, tuple[str, str, str, str]] = {
            DT.OAB: (
                "source",
                "target",
                "allocated_interactions",
                "activities",
            ),
            DT.SAB: (
                "source.owner",
                "target.owner",
                "allocated_functional_exchanges",
                "allocated_functions",
            ),
            DT.LAB: (
                "source.owner",
                "target.owner",
                "allocated_functional_exchanges",
                "allocated_functions",
            ),
            DT.PAB: (
                "source.owner",
                "target.owner",
                "allocated_functional_exchanges",
                "allocated_functions",
            ),
        }
        _, _, alloc_fex, _ = intermap[diagram.type]
        get_alloc_fex = operator.attrgetter(alloc_fex)

        yield from get_alloc_fex(diagram.target)