Skip to content

Commit

Permalink
Merge pull request #102 from DSD-DBS/capability-exchanges
Browse files Browse the repository at this point in the history
Capability exchanges
  • Loading branch information
Wuestengecko committed Jun 24, 2022
2 parents 3fb7496 + d36b82d commit 19dd0f1
Show file tree
Hide file tree
Showing 14 changed files with 6,791 additions and 6,550 deletions.
54 changes: 54 additions & 0 deletions capellambse/aird/capstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ class in the form::
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.MissionInvolvement": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
},
"Error": {},
"Functional Chain Description": {
Expand Down Expand Up @@ -503,6 +508,53 @@ class in the form::
"text_fill": COLORS["_CAP_xAB_Function_Border_Green"],
},
},
"Missions Capabilities Blank": {
"Box.SystemComponent": {
"fill": [COLORS["_CAP_Actor_Blue_min"], COLORS["_CAP_Actor_Blue"]],
"stroke": COLORS["_CAP_Actor_Border_Blue"],
"text_fill": COLORS["_CAP_Actor_Blue_label"],
},
"Box.SystemActor": {
"fill": [COLORS["_CAP_Actor_Blue_min"], COLORS["_CAP_Actor_Blue"]],
"stroke": COLORS["_CAP_Actor_Border_Blue"],
"text_fill": COLORS["_CAP_Actor_Blue_label"],
},
"Box.SystemHumanActor": {
"fill": [COLORS["_CAP_Actor_Blue_min"], COLORS["_CAP_Actor_Blue"]],
"stroke": COLORS["_CAP_Actor_Border_Blue"],
"text_fill": COLORS["_CAP_Actor_Blue_label"],
},
"Edge.AbstractCapabilityExtend": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.AbstractCapabilityGeneralization": {
"marker-end": "GeneralizationMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.AbstractCapabilityInclude": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.CapabilityExploitation": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.CapabilityInvolvement": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
"Edge.MissionInvolvement": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
"stroke-width": 1,
},
},
"Mode State Machine": { # (from common.odesign)
"Box.ChoicePseudoState": {
"fill": COLORS["_CAP_ChoicePseudoState_Color"],
Expand Down Expand Up @@ -559,6 +611,7 @@ class in the form::
},
"Edge.AbstractCapabilityExtend": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
},
"Edge.AbstractCapabilityGeneralization": {
"marker-end": "GeneralizationMark",
Expand All @@ -575,6 +628,7 @@ class in the form::
"Edge.Entity": {},
"Edge.EntityOperationalCapabilityInvolvement": {
"marker-end": "FineArrowMark",
"stroke": COLORS["black"],
},
"Edge.OperationalActor": {},
},
Expand Down
20 changes: 7 additions & 13 deletions capellambse/model/crosslayer/fa.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright DB Netz AG and the capellambse contributors
# SPDX-License-Identifier: Apache-2.0

"""Implementation of objects and relations for Functional Analysis
"""Implementation of objects and relations for Functional Analysis.
Functional Analysis objects inheritance tree (taxonomy):
Expand All @@ -21,7 +21,7 @@

from .. import common as c
from .. import modeltypes
from . import capellacommon, capellacore, information
from . import capellacommon, capellacore, information, interaction

if t.TYPE_CHECKING:
from . import cs
Expand Down Expand Up @@ -83,7 +83,7 @@ def __dir__(self) -> list[str]:

@c.xtype_handler(None)
class AbstractFunction(c.GenericElement):
"""An AbstractFunction"""
"""An AbstractFunction."""

available_in_states = c.AttrProxyAccessor(
capellacommon.State, "availableInStates", aslist=c.ElementList
Expand All @@ -92,7 +92,7 @@ class AbstractFunction(c.GenericElement):

@c.xtype_handler(None)
class FunctionPort(c.GenericElement):
"""A function port"""
"""A function port."""

owner = c.ParentAccessor(c.GenericElement)
exchanges: c.Accessor
Expand Down Expand Up @@ -150,16 +150,10 @@ def owner(self) -> ComponentExchange | None:
return self.allocating_component_exchange


class FunctionalChainInvolvement(c.GenericElement):
class FunctionalChainInvolvement(interaction.AbstractInvolvement):
"""Abstract class for FunctionalChainInvolvementLink/Function."""

_xml = "ownedFunctionalChainInvolvements"

involved = c.AttrProxyAccessor(c.GenericElement, "involved")

@property
def name(self) -> str: # type: ignore
return f"[{self.__class__.__name__}] to {self.involved.name} ({self.involved.uuid})"
_xmltag = "ownedFunctionalChainInvolvements"


@c.xtype_handler(None)
Expand All @@ -176,7 +170,7 @@ class FunctionalChainInvolvementLink(FunctionalChainInvolvement):

@c.xtype_handler(None)
class FunctionalChainInvolvementFunction(FunctionalChainInvolvement):
"""An element linking a FunctionalChain to a Function"""
"""An element linking a FunctionalChain to a Function."""


@c.xtype_handler(None)
Expand Down
50 changes: 48 additions & 2 deletions capellambse/model/crosslayer/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

XT_CAP2PROC = "org.polarsys.capella.core.data.interaction:FunctionalChainAbstractCapabilityInvolvement"
XT_CAP2ACT = "org.polarsys.capella.core.data.interaction:AbstractFunctionAbstractCapabilityInvolvement"
XT_CAP_GEN = "org.polarsys.capella.core.data.interaction:AbstractCapabilityGeneralization"
XT_SCENARIO = "org.polarsys.capella.core.data.interaction:Scenario"
XT_CAP_REAL = (
"org.polarsys.capella.core.data.interaction:AbstractCapabilityRealization"
)
Expand All @@ -15,3 +13,51 @@
@c.xtype_handler(None)
class Scenario(c.GenericElement):
"""A scenario that holds instance roles."""


class Exchange(c.GenericElement):
"""An abstract Exchange."""

source = c.ParentAccessor(c.GenericElement)


@c.xtype_handler(None)
class AbstractCapabilityExtend(Exchange):
"""An AbstractCapabilityExtend."""

_xmltag = "extends"

target = c.AttrProxyAccessor(c.GenericElement, "extended")


@c.xtype_handler(None)
class AbstractCapabilityInclude(Exchange):
"""An AbstractCapabilityInclude."""

_xmltag = "includes"

target = c.AttrProxyAccessor(c.GenericElement, "included")


@c.xtype_handler(None)
class AbstractCapabilityGeneralization(Exchange):
"""An AbstractCapabilityGeneralization."""

_xmltag = "superGeneralizations"

target = c.AttrProxyAccessor(c.GenericElement, "super")


class AbstractInvolvement(c.GenericElement):
"""An abstract Involvement."""

involved = c.AttrProxyAccessor(c.GenericElement, "involved")

@property
def name(self) -> str: # type: ignore
return f"[{self.__class__.__name__}] to {self.involved.name} ({self.involved.uuid})"


@c.xtype_handler(None)
class AbstractFunctionAbstractCapabilityInvolvement(AbstractInvolvement):
"""An abstract CapabilityInvolvement linking to SystemFunctions."""
8 changes: 5 additions & 3 deletions capellambse/model/diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import abc
import base64
import collections as cabc
import collections.abc as cabc
import importlib.metadata as imm
import logging
import operator
Expand Down Expand Up @@ -65,6 +65,8 @@ class AbstractDiagram(metaclass=abc.ABCMeta):
* The only top-level element in the diagram **OR**
* The element which is considered to be the "element of interest".
"""
filters: cabc.MutableSet[str]
"""The filters that are activated for this diagram."""

_model: capellambse.MelodyModel
_render: aird.Diagram
Expand Down Expand Up @@ -345,8 +347,8 @@ def type(self) -> modeltypes.DiagramType:
LOGGER.warning("Unknown diagram type %r", sc)
return modeltypes.DiagramType.UNKNOWN

@property
def filters(self) -> t.MutableSet[str]:
@property # type: ignore[override]
def filters(self) -> cabc.MutableSet[str]: # type: ignore[override]
"""Return a set of currently activated filters on this diagram."""
return aird.ActiveFilters(self._model, self)

Expand Down
Loading

0 comments on commit 19dd0f1

Please sign in to comment.