Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Expressions and MOKA(How can I use MOKA with expressions that use parameters from classes?)
Expressions and MOKA [message #1746776] Fri, 04 November 2016 13:20 Go to next message
Bruno Costa is currently offline Bruno CostaFriend
Messages: 15
Registered: November 2014
Junior Member
Dear folks,

Is it possible to use MOKA considering parameters from classes to be used in expressions? For example, I have this expression "a + b". I have classes that has the parameters a and b. Now, I created a simple activity diagram with MOKA and I'd like to read a and b from classes and run the expression a + b.

Is it possible?
Re: Expressions and MOKA [message #1747207 is a reply to message #1746776] Thu, 10 November 2016 17:31 Go to previous messageGo to next message
Jeremie Tatibouet is currently offline Jeremie TatibouetFriend
Messages: 10
Registered: April 2014
Junior Member
Dear Bruno -

it is possible to achieve the goal you mention with Moka.

[1] Create a class and make sure it is active (isActive property is true).
[2] Add two properties a and b in this the created class. These properties might be of type Integer.
[3] Create an activity in your class.
[4] Set the activity as being the classifier behavior of that class. To do so, select your class, go to the advance tab and in the field classifier behavior make sure the activity is referenced.
[5] Implement your activity to perform the addition
----[5.1] Add a read structural feature for property a
----[5.2] Add a read structural feature for property b
----[5.3] Add a call behavior for PrimitiveBehaviors::IntegerFunctions::+. You need to have imported the fUML library to achieve this.
----[5.4] Connect result pin of read structural for property a to input pin x of the call behavior for PrimitiveBehaviors::IntegerFunctions::+ using an ObjectFlow.
----[5.5] Connect result pin of read structural for property b to input pin y of the call behavior for PrimitiveBehaviors::IntegerFunctions::+ using an ObjectFlow.
----[5.6] Add a call behavior for PrimitiveBehaviors::IntegerFunctions::ToString.
----[5.7] Connect the result pin of the call behavior for PrimitiveBehaviors::IntegerFunctions::+ to the input pin x of the call behavior for PrimitiveBehaviors::IntegerFunctions::ToString using an ObjectFlow.
----[5.7] Add a call behavior for BasicInputOutput::WriteLine.
----[5.8] Connect the result pin of the call behavior for PrimitiveBehaviors::IntegerFunctions::ToString to the pin value of the call behavior for BasicInputOutput::WriteLine.
[6] Define an activity that
----[6.1] Instantiate your class
----[6.2] Initialize values of properties a and b.
----[6.3] Start the classifier behavior associated to the class you defined.
[7] Create a run configuration and indicate this activity as being the Element to be executed.
[8] Run your model. You must end up with the value corresponding to the result of the addition displayed in the console.

Let me know if that helps.

Jérémie
Re: Expressions and MOKA [message #1747987 is a reply to message #1747207] Thu, 17 November 2016 13:09 Go to previous messageGo to next message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 34
Registered: April 2010
Member
Hi Bruno,

In addition, you can also have a look at this tutorial: https://www.youtube.com/watch?v=itiAu9QZTMY&list=PL9nkS1KDTMm7XBenuBonLyAch1xFXiiuw&index=4
The tutorial is related to the FMI functionnalities of Moka, but you can probably inspire from it.

Basically, so far, there is no built in support for "expression evaluation" in Moka. This is why, as explained by Jérémie, the expression has to be "encoded" in an activity.

Please note also that Papyrus provides basic support for the Alf action language, so that you can specifiy textually the Activity described by Jeremie.

Cheers,

Arnaud

[Updated on: Thu, 17 November 2016 13:14]

Report message to a moderator

Re: Expressions and MOKA [message #1748092 is a reply to message #1747987] Fri, 18 November 2016 12:25 Go to previous messageGo to next message
wpila Mising name is currently offline wpila Mising nameFriend
Messages: 6
Registered: November 2016
Junior Member
Hello Bruno!

Look at this:

https://www.eclipse.org/forums/index.php/t/1082515/

I am fighting for you.

Greetings

Wieslaw


Re: Expressions and MOKA [message #1748093 is a reply to message #1748092] Fri, 18 November 2016 12:51 Go to previous message
Arnaud Cuccuru is currently offline Arnaud CuccuruFriend
Messages: 34
Registered: April 2010
Member
ahah, great fight, by the way Razz
Previous Topic:Exception running Moka example
Next Topic:changing .uml model file do not change .di model file
Goto Forum:
  


Current Time: Thu Oct 10 02:39:00 GMT 2024

Powered by FUDForum. Page generated in 0.04849 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top