gobravedave / Enterprise-Architect

scripts and other code snippets to extend Sparxs Enterprise Architect
BSD 2-Clause "Simplified" License
51 stars 12 forks source link

Bug that asynchronous message response becomes synchronous message response #12

Closed Takashi-K-TakaTech closed 1 year ago

Takashi-K-TakaTech commented 2 years ago

PlantUML source where it occurs:

@startuml
main ->> job : test1 cmd
alt wait response
job –>> main : complete test1
end
main ->> job : test2 cmd
alt wait response
job –>> main : complete test2
end
main ->> job : test3 cmd
alt wait response
main <<– job : complete test 3
end
@enduml

It may be due to the fact that when the arrow line pattern is specified as a dotted line, it is determined to be synchronous and not determined to be a response message.

I added judgment conditions to the synchronization judgment and the response message judgment, respectively. In order to keep the code simple, the judgment conditions are summarized in an array element. The original judgment condition of "isReturn" was also changed because I thought it was not correct.

The modified source for now: Create-Sequence-Diagram of PlantUML:

function synch(arrow)
dim AsyncArrows
dim i

    AsyncArrows = Array("-&gt;&gt;", "->>", "--&gt;&gt;", "-->>")
    call LOGTrace("synch(" & arrow & ")")
    synch = "Synchronous"
    for i=0 to UBound(AsyncArrows)
        if arrow = AsyncArrows(i) then
            synch = "Asynchronous"
            exit for
        end if
    next
    call LOGTrace("synch=" & synch)
end function

function isReturn(arrow)
dim returnArrows
dim i

    returnArrows = Array("--&gt;", "-->", "--&gt;&gt;", "-->>", "&lt;--", "<--", "&lt;&lt;--", "<<--")
    call LOGTrace("isReturn(" & arrow & ")")
    isReturn = 0
    for i=0 to UBound(returnArrows)
        if arrow = returnArrows(i) then
            isReturn = 1
            exit for
        end if
    next
    call LOGTrace("isReturn=" & isReturn)

end function
gobravedave commented 1 year ago

thanks @Takashi-K-TakaTech I believe your problem is fixed..