Home » Modeling » Epsilon » Java and epsilon ecl syncronizathion(Issues with the value of a variable)
Java and epsilon ecl syncronizathion [message #1861488] |
Mon, 16 October 2023 10:01 |
Mauro Sonzogni Messages: 10 Registered: October 2023 |
Junior Member |
|
|
Good morning,
I'm having some issues with the value of a variable that gets modified within a rule in the "do" section. I initialize my variable during the "pre" phase, and then its value gets modified within the "do" section. However, what's happening is that when I attempt to retrieve the value on the Java side, I'm experiencing non-deterministic behavior. In other words, sometimes I get the default value, and other times I get the modified value (for safety, I've also tried setting both "guard" and "compare" to true). The execution of my module (module.execute()) is within a try-catch block, and I'm trying to retrieve the value only after the catch block (to avoid issues in case of an error).
Thank you in advance,
Mauro.
|
|
| | | | | | |
Re: Java and epsilon ecl syncronizathion [message #1861499 is a reply to message #1861496] |
Mon, 16 October 2023 17:09 |
|
Hi Mauro,
Thanks for your effort on this. The example doesn't need to have "generality"; it just needs to demonstrate the issue you are encountering with as little code as possible. Do you really need a nested for loop, five models with hundreds of model elements conforming to complex metamodels, and ~100 lines of ECL to demonstrate this issue? If you find further slimming down this example challenging, perhaps you could start with a simpler example (e.g. https://eclipse.dev/epsilon/playground/?eml - just the ECL part) and add complexity to it until the issue starts appearing there too.
Thanks,
Dimitris
|
|
| |
Re: Java and epsilon ecl syncronizathion [message #1861501 is a reply to message #1861500] |
Mon, 16 October 2023 18:57 |
|
> I cannot remove the nested loops as I suspect the issue might be coming from there.
Well, one of us needs to test this hypothesis. If you suspect that multiple executions may be causing the issue, start by trying exactly 2 executions.
Thanks,
Dimitris
|
|
| | | |
Re: Java and epsilon ecl syncronizathion [message #1861550 is a reply to message #1861522] |
Wed, 18 October 2023 12:19 |
|
Changing line 13 of the ECL program to
editDistance=0.5.asDouble().println("Edit distance changed to: ");
doesn't print anything to the console in the current version of the code in the repo. This suggests that there are no matches for this rule. Is this expected?
Thanks,
Dimitris
|
|
|
Re: Java and epsilon ecl syncronizathion [message #1861552 is a reply to message #1861550] |
Wed, 18 October 2023 13:10 |
Mauro Sonzogni Messages: 10 Registered: October 2023 |
Junior Member |
|
|
Hi,
no, I didn't expect there to be no match either. Yesterday, while delving into this with my tutor Ludovico Iovino, he pointed out this issue to me. We tried changing the match, and at that point, it entered the rule correctly, but the result I was getting on the Java side still wasn't the one updated by the rule. Now he advised me to change my approach and use the match trace to achieve my goal. However, I have another question: how can I perform a match on subtypes? Currently, the rule wasn't returning a match because the match was made on `ComponentInstances` and not on its subtypes, `SystemInstance`. If I wanted to perform a match on `ComponentInstance` and its subtypes, how could I do that?
Thank you very much,
Mauro.
|
|
| | |
Re: Java and epsilon ecl syncronizathion [message #1861555 is a reply to message #1861553] |
Wed, 18 October 2023 14:22 |
Mauro Sonzogni Messages: 10 Registered: October 2023 |
Junior Member |
|
|
Hello, I've updated the code and set the rule as greedy. Now, it does find a match, but it still doesn't print the value to the console in the 'do' part, which I expected it to do at this point. In addition to this, I've tried adding information to the 'Info' map of the match trace, but without any results (I saw that you had answered a similar question in the past, but the link you provided leads to a 404 error, so I relied on what another user had responded). Could you please guide me on the correct way to do this?
Thanks, Mauro.
|
|
| |
Goto Forum:
Current Time: Sat Apr 27 08:04:23 GMT 2024
Powered by FUDForum. Page generated in 0.05165 seconds
|