MetaCase Homepage
Forum Home Forum Home > > MetaEdit+
  New Posts New Posts RSS Feed - access decomposition recursively
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

access decomposition recursively

 Post Reply Post Reply
Author
Message
djomeni View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 17.Jun.2011
Location: france
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote djomeni Quote  Post ReplyReply Direct Link To This Post Topic: access decomposition recursively
    Posted: 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
Back to Top
stevek View Drop Down
MetaCase
MetaCase
Avatar

Joined: 11.Mar.2008
Points: 643
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevek Quote  Post ReplyReply Direct Link To This Post 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
   }
}
Back to Top
djomeni View Drop Down
Major Contributor
Major Contributor
Avatar

Joined: 17.Jun.2011
Location: france
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote djomeni Quote  Post ReplyReply Direct Link To This Post Posted: 20.Jul.2011 at 18:37
cool, thank you!!!!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.05
Copyright ©2001-2022 Web Wiz Ltd.

This page was generated in 0.023 seconds.