Parameter values and corresponding name during Simulation

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Parameter values and corresponding name during Simulation

Postby » Sun Apr 07, 2019 3:17 pm

Hello together,

I want to retrieve values and get their corresponding name during the Simulation of an Activity.
I wrote an SimulationExecutionListener and worked on the method elementactivitated(element, values).
This method obtains the variable "values" as argument. "values" contains the tokens that are related to the behavior.
Code: Select all
public void elementActivated(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element element, java.util.Collection<?> values) {
      if (element instanceof CallBehaviorAction) {
         for (Object e : values) {
            if (e instanceof Token) {
               Value token = ((Token) e).getValue();
               if (token != null)
               System.out.println( "Tokenvalue:" + token);

In the code above I managed to retrieve the token values, what is missing is the corresponding argument name in order to know which parameter of the CallBehaviorAction belongs to which token value.

Thank you very much
Forum Newbie
Forum Newbie
Posts: 1
Posts Rating:1
Joined: Sun Mar 10, 2019 5:41 am

Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests