Order of messages in Sequence Diagrams

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Order of messages in Sequence Diagrams

Postby Marco Wehrmeister » Sun Aug 19, 2007 4:16 am

Hi,

I'm implementing a plugin to calculate metrics for "separation of
concerns" of a model. One of them should count the number of methods
(primary methods) that handle a specified concern, as well as the number
of methods that handle indirectly the concern (that is, methods that
call one or more primary methods).

To reach this goal, one option is to interpret sequence diagrams in
order to discover the method call stack. Therefore, I need to get a list
of messages with the same order that appear within the sequence diagram.
I tried to get this ordered list by using the getFragment() and
getEvent() methods of Interaction, but the elements order of the
returned lists is not the same thats appear when the sequence diagram is
opened with Magic Draw.

So, the question is: how to get a ordered list of messages from a
sequence diagram? The order should be the same that appears when opening
it in Magic Draw.

Kind regards,
Marco

---
Ph.D. student at
Embedded Systems Lab - Informatics Institute
Federal University of Rio Grande do Sul - Brazil
Marco Wehrmeister
 
Posts Rating:

Re: Order of messages in Sequence Diagrams

Postby Martynas Lelevicius » Mon Aug 20, 2007 2:32 am

Hi Marco,

The order is stored by the presentation elements - message view has a
number:

List number = null;
if (presentationElement instanceof SeqBaseMessageView)
{
number = ((SeqBaseMessageView) presentationElement).getNumber();
}

It is a full message number, e.g. number list ["2", "1", "1"] means message
number 2.1.1
You should collect message views and compare the number lists.

To get a presentation elements of the message you can use:
project.getSymbolElementMap().getAllPresentationElements(message);

Regards,
--
Martynas Lelevicius
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
E-mail : marte
WWW: http://www.magicdraw.com

Martynas Lelevicius
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests