![]() |
access decomposition recursively |
Post Reply
|
| Author | |
djomeni
Major Contributor
Joined: 17.Jun.2011 Location: france Points: 26 |
Post Options
Thanks(0)
Quote Reply
Topic: access decomposition recursivelyPosted: 20.Jul.2011 at 15:43 |
|
Hi all,
I am working on a meta model that can have many subgraph (by using decomposition). Decomposition is available only on object named "strategy" How to access all decompositions and sub decompositions recursively, without knowing in advance the number of sugbraph? curently I use: foreach .strategy { do decompositions /*access level -1 of graph*/ { if id<>'*' then foreach .() do decompositions /*access level -2 of graph*/ { ...} else endif } } but I should know in advance the maximum number of level in my instance(graph) to use it. if I have 3 level, it doesn't work for level 3, until I add code to handle it |
|
![]() |
|
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Posted: 20.Jul.2011 at 16:06 |
|
You can write a recursive generator. Here's the basic structure, which just goes through all the subgraphs: obviously you'll want to add some commands for each subgraph, strategy etc. You may also need to think about what to do if the decomposition structure isn't a tree: e.g. if the same subgraph can be reached by multiple paths, or if there are cycles in the decomposition structure.
Report 'List decompositions'
foreach .strategy
{ do decompositions
{ subreport 'List decompositions' run
}
}
|
|
![]() |
|
djomeni
Major Contributor
Joined: 17.Jun.2011 Location: france Points: 26 |
Post Options
Thanks(0)
Quote Reply
Posted: 20.Jul.2011 at 18:37 |
|
cool, thank you!!!!
|
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |