Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ECL] How to count the number of elements of a model
[ECL] How to count the number of elements of a model [message #1355458] Wed, 14 May 2014 18:47 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

I'd like to meet the following requirements using ECL:

Context:
Left Model has 1 dependency with a supplier of a certain type "Operation"
Right Model has 2 dependencies with the same supplier type as in the Left Model, namely "Operation"

Matching requirements:
Only one of the 2 dependencies of Right Model is counted as a match,
the second dependency of the Right Model is counted as a mismatch, as it is an additional element.

My idea is to count the number of the Left and Right Model dependencies with the same supplier types, in order to compare these numbers.

How can I accomplish this? Does any method exist to do this within a module?

Thanks a lot for your support and kind regards, Alex
Re: [ECL] How to count the number of elements of a model [message #1356958 is a reply to message #1355458] Thu, 15 May 2014 09:46 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

I'm afraid that I don't fully understand the question. Could you please elaborate a bit more? What have you tried so far?

Cheers,
Dimitris
Re: [ECL] How to count the number of elements of a model [message #1356995 is a reply to message #1356958] Thu, 15 May 2014 10:06 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

no problem, of course I can elaborate it a bit more Wink.

Let it bring me to a simple question: How can I count elements of a certain type of the left and the right model? E.g., I tried to do the following: Left!Dependency.count(); => get the number of existing dependencies in the left model. This did not work ;-(.

I attached an illustration of the comparison scenario I have. Note that names of any model elements are not relevant. Only types are evaluated.

Have a look at numbers 3 and 6 in the picture. The ProblemBearing dependency with the supplier type "Property" (called "attribute1") occurs 2 times in the left model and 1 time in the right model. Hence, there is one valid match and one invalid match.

My idea is to find out this difference by counting the elements of a type. That's what I tried to explain in the first submission of my question. Maybe there is more simple way to meet my requirement?

Thanks a lot and kind regards, Alex
Re: [ECL] How to count the number of elements of a model [message #1357004 is a reply to message #1356995] Thu, 15 May 2014 10:11 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2162
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

As discussed in Section 3.9 of the Epsilon book, to retrieve all the instances of a type you can use the .all/allInstances method/property e.g. Left!Dependency.all.size() in your example.

Cheers,
Dimitris
Re: [ECL] How to count the number of elements of a model [message #1372410 is a reply to message #1357004] Wed, 21 May 2014 20:37 Go to previous message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks a lot for the hint. It worked fine. I was able to meet my requirements with these functions.

Cheers, Alex
Previous Topic:[ECL] How can I determine a type from a set
Next Topic:[Emfatic] syntax for enums/key value
Goto Forum:
  


Current Time: Fri Apr 19 06:36:12 GMT 2024

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

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

Back to the top