用序列图绘制调用流程会导致歧义

发布于 2024-09-24 15:06:15 字数 1387 浏览 2 评论 0原文

我想画一个序列图,

A -> B.run()
B.run() -> B.m1()
B.m1() -> B.m2()

到目前为止我已经想出了这些。

http://i51.tinypic.com/eja5bl.jpg http://i52.tinypic.com/1449s3.jpg

但在这里我不能明确提及B.m2() 被 B.m1() 调用 相反,它看起来像 B.run() 串行调用 B.m1() 和 B.m2() 。

------------- 编辑 ----------------

这是我目前绘制的http://i55.tinypic.com/21276kk.jpg

我现在的图还好吗? 我想要的是这个。 (通话流程)

SpiritAdapter -> SpiritEngine::run(spirit:string, method:string, args[])
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::executeLogic(spirit:string, method:string, args[])
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritEngine::spirit(spirit:string, method:string, args[])
SpiritEngine::spirit(spirit:string, method:string, args[]) -> new SpiritAbstractor
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritAbstractor::method(args)
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::storeXDO()

I want to draw a Sequence Diagram Where

A -> B.run()
B.run() -> B.m1()
B.m1() -> B.m2()

So far I've come up with these.

http://i51.tinypic.com/eja5bl.jpg
http://i52.tinypic.com/1449s3.jpg

But Here I cannot mention it clearly that B.m2() is called by B.m1()
Rather it looks like B.run() Calls both B.m1() and B.m2() serially.

------------- EDIT ----------------

This is What I Currently have drawn http://i55.tinypic.com/21276kk.jpg


Well Is my Current Diagram Okay ??
What I want is this. (Call Flow)

SpiritAdapter -> SpiritEngine::run(spirit:string, method:string, args[])
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::executeLogic(spirit:string, method:string, args[])
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritEngine::spirit(spirit:string, method:string, args[])
SpiritEngine::spirit(spirit:string, method:string, args[]) -> new SpiritAbstractor
SpiritEngine::executeLogic(spirit:string, method:string, args[]) -> SpiritAbstractor::method(args)
SpiritEngine::run(spirit:string, method:string, args[]) -> SpiritEngine::storeXDO()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愿得七秒忆 2024-10-01 15:06:15

您可以在 B.m2() 上添加一个小条,然后放置一个自指向箭头,例如

alt text

自传消息与递归调用

alt text

You can add a small bar over B.m2() and then place a self pointing arrow, for example.

alt text

Self message vs recursive call

alt text

野心澎湃 2024-10-01 15:06:15

uml 规范允许直观地显示嵌套调用:被调用的生命线应该覆盖在调用的生命线上。请参阅 此示例中的 certainAvailableReport() 调用

当然,您的工具是否支持它是另一回事......

The uml spec allows for a nested call to be shown visually: the called lifeline should be overlaid on the calling lifeline. See e.g. determineAvailableReport() call in this example.

Whether your tool supports it of course is another matter...

在梵高的星空下 2024-10-01 15:06:15

假设 ObjectA 有 3 个方法,分别称为 MessageOne()、MessageTwo() 和 MessageThree()。

它们之间的关系如下所示。

void ObjectA::MessageOne()
{
    MessageTwo();
}

void ObjectA::MessageTwo()
{
   MessageThree();
}

void ObjectA::MessageThree()
{
   // TODO
}

使用 Enterprise Architect 如下图所示,如果您选择 MessageThree() 调用,您将获得提高激活级别的选项。

输入图片此处描述

一旦您选择该选项(通过单击->箭头),您将获得满足调用堆栈序列图的精确图(如下所示)。

输入图片此处描述

Lets say ObjectA has 3 methods called MessageOne(), MessageTwo() and MessageThree().

And the relation between them are shown below

void ObjectA::MessageOne()
{
    MessageTwo();
}

void ObjectA::MessageTwo()
{
   MessageThree();
}

void ObjectA::MessageThree()
{
   // TODO
}

Using Enterprise Architect as shown in the image below if you select MessageThree() call you will get an option to raise the activation level.

enter image description here

Once you choose that option(By clicking on -> arrow) you will get the exact diagram(Shown below) which satisfy sequence diagram of call stack.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文