Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Adding values to the links and summing them up
Adding values to the links and summing them up [message #1075969] Tue, 30 July 2013 12:22 Go to next message
abdelkader didouh is currently offline abdelkader didouhFriend
Messages: 6
Registered: May 2013
Junior Member
Dear ALL

basically i my project i need to give numerical values to the links and keep track of the added links and at the end by clicking a button (or automatically) returns the sum of the values that we gave to the links.

For example : i have nodes A B C D anD Links X,Y

and the diagram would be as follow :

A----Y----B
A----Y----C
B----X----D

i need to give the Links values like Y=2 and X=1

at the end i need to get
SY(Sum of Ys)=4
SX(Sum of Xs)= 1

can some one explain to me how to do that ? OH and the links have already an Int attribute for the values


Kind regards
Re: Adding values to the links and summing them up [message #1096367 is a reply to message #1075969] Wed, 28 August 2013 09:38 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

are the links instance of Y and instance of X in the meta-model? If yes you can solve it by an OCL statement which looks like X.allInstances().intValue->sum(). There is also a tree iterator available if you call the EMF method to get the content of the diagram root of the semantic model. You would then walk over the model tree and check with instance of and sum the attribute values up.

Ralph
Previous Topic:WorkspaceSynchronizer getFile
Next Topic:GMF support in a stack of e4 application
Goto Forum:
  


Current Time: Sun Dec 21 10:46:20 GMT 2014

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

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