Print Page | Close Window

Context of conditional generator code

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=151
Printed Date: 27.Mar.2026 at 02:15
Software Version: Web Wiz Forums 12.05 - http://www.webwizforums.com


Topic: Context of conditional generator code
Posted By: jkouwer
Subject: Context of conditional generator code
Date Posted: 04.Jun.2010 at 11:47
Hello,

Something I could not find in the manual: What is the context of the code entered in the conditional tab and in the content tab of the symbol editor? The Object / Role / Relation the symbol belongs to or the graph that contains (is going to contain) the element?

Regards,
Jeroen Kouwer



Replies:
Posted By: stevek
Date Posted: 04.Jun.2010 at 13:10
The context of a generator is a stack; a normal top-level generator starts with a stack containing just the graph, and inside a foreach loop it will have the graph and an object. The stack in a generator in an object symbol is also the graph and the object: id will return the name of the object, and id;1 the name of the graph.
 
This lets you do rather cool things: not only can you navigate from the object in the graph with do loops, but you can also effectively jump back out to the graph itself with a foreach loop (so your stack is myGraph, myObject, anotherObject). Obviously this can affect the speed of display, since it changes it from O(N) to O(N2): if you're displaying a graph with 10 objects, and each iterates over all 10 other objects, one refresh now does 100 object visits rather than 10. You'll generally be fine with one or even two layers like that, but by the time you get to O(N4) even the  http://www.metacase.com/blogs/stevek/blogView?showComments=true&entry=3385914921 - speed of MERL can't save you Smile



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