Skip to content

Implement DFS in add() method of Package class for Dependency objects #44

@capsulecorplab

Description

@capsulecorplab

Open to alternative implementation strategies, but this issue should, in essence, check if both objects referenced in both "supplier" and "client" attributes of a Dependency object exist in the Package object, or Package objects recursively therein, when passed through a Package objects add() method.

e.g.,

>>> timemachine = sysml.Package('time machine')
>>> req = sysml.Requirement('top requirement', 'make time travel possible')
>>> fluxcapacitor = sysml.Block('flux capacitor')
>>> timemachine.add(Dependency(req, fluxcapacitor))

The above would raise an AttributeError, because neither timetravel nor fluxcapacitor are defined in timemachine

Working example:

>>> timemachine = sysml.Package('time machine')
>>> req = sysml.Requirement('top requirement', 'make time travel possible')
>>> fluxcapacitor = sysml.Block('flux capacitor')
>>> timemachine.add(req)
>>> timemachine.add(fluxcapacitor)
>>> timemachine.add(Dependency(req, fluxcapacitor))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions