【问题标题】:Nested if statement in plantumlPlantuml 中的嵌套 if 语句
【发布时间】:2021-06-11 16:27:22
【问题描述】:

我正在尝试在 plantuml 中执行嵌套 if 语句。代码如下:

@startuml
start
:Search for File;
if(Is in local cache?) then (yes)
    :Finish;
    stop
else (no)
    :Check Cached SearchObjectToNodeTb;
        if(Find in SearchObjectToNodeTb) then (yes)
            :Send refresh req. SO to SN;
        else(No)
            :Send SO query to closest SymbolToNodeCacheTb match;
            if(Symbol in Table) then (yes)
                switch(What role am I?)
                    case(SearchNode)
                        :Send out Query to SN and get SearchObject;
                    case(FileNode)
                        :Return results;
            else(No)//can't find the if statement for here
                switch(What role am I?)
                    case(client)
                        :Send to Node with closest result;
                    case(SearchNode)
                        :Perform alg. for tablesym. creation;


@enduml

它看不到 else 的最后一个 if 语句。是否可以在 Plantuml 中进行嵌套 if else 语句?

【问题讨论】:

    标签: plantuml


    【解决方案1】:

    据我所知,endswitch(参见例如https://plantuml.com/activity-diagram-beta)对我来说缺少以下作品:

    @startuml
    start
    :Search for File;
    if(Is in local cache?) then (yes)
        :Finish;
        stop
    else (no)
        :Check Cached SearchObjectToNodeTb;
            if(Find in SearchObjectToNodeTb) then (yes)
                :Send refresh req. SO to SN;
            else(No)
                :Send SO query to closest SymbolToNodeCacheTb match;
                if(Symbol in Table) then (yes)
                    switch(What role am I?)
                        case(SearchNode)
                            :Send out Query to SN and get SearchObject;
                        case(FileNode)
                            :Return results;
                    endswitch
                else(No)
                    switch(What role am I?)
                        case(client)
                            :Send to Node with closest result;
                        case(SearchNode)
                            :Perform alg. for tablesym. creation;
                    endswitch
    @enduml
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多