Print Page | Close Window

access decomposition recursively

Printed From: MetaCase
Category:
Forum Name: MetaEdit+
Forum Description: All topics relating to MetaEdit+ or DSM
URL: https://www.metacase.com/forums/forum_posts.asp?TID=261
Printed Date: 27.Mar.2026 at 00:26
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: access decomposition recursively
Posted By: djomeni
Subject: access decomposition recursively
Date 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



Replies:
Posted By: stevek
Date 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
   }
}


Posted By: djomeni
Date Posted: 20.Jul.2011 at 18:37
cool, thank you!!!!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.05 - http://www.webwizforums.com
Copyright ©2001-2022 Web Wiz Ltd. - https://www.webwiz.net