![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Alternative to 'for <thing> in <thingSet> do?? Topic Summary: Created On: 16-Dec-2003 14:45 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi,
Is there not a way to access collection items (e.g. objects in a module, history records in an object, etc) other than using the for-in-do loop?? This method seems highly inefficient. What if you want to loop in reverse? What if you just want to know how many items are in the set? Surely there must be a way to get this info other than doing a counter inside a for-in-do loop? While I'm not willing to hold my breath on this one, I do have my fingers crossed! :-) Regards, Robin ------------------------- -------------------------------------- Robin Riley Motorola, Inc Robin.Riley@motorola.com |
|
![]() |
|
![]() |
|
The for o in m loop respects the current display set, so you can improve efficiency by applying a filter or sort or setting the level to the module before entering the loop.
Objects can be accessed directly via their absolute number, e.g. o = object(23) Not much help I know, but I can't think of another way. ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
I agree with the Gallion. To which I add... If you plan to do a lot of searching then you might as well put the "stuff" in a Skip list and then search for it there. This is less effecient than programming it but more effecient; much more efficient execution style. The major down side is when you add or remove a "stuff" you need to update your Skip.
For example, a script you may write to link the current module to specific objects in a target module will work more effeciently if you put all the target objects in a skip, using the int AbsNo and Object handle, and then search the Skip. - Louie Edited: 5-Jan-2004 at 14:57 by Louie Landale |
|
![]() |
|
![]() |
|
I agree with the Gallion. To which I add... If you plan to do a lot of searching then you might as well put the "stuff" in a Skip list and then search for it there. This is less effecient than programming it but more effecient; much more efficient execution style. The major down side is when you add or remove a "stuff" you need to update your Skip.
For example, a script you may write to link the current module to specific objects in a target module will work more effeciently if you put all the target objects in a skip, using the int AbsNo and Object handle, and then search the Skip. - Louide |
|
![]() |
|
![]() |
|
Hi,
Thanks for your responses... I guess basically I'm just spoiled from working with real languages (e.g. C, C++, etc) and the convenience of being able to go in either direction, being able to "bookmark" a certain location in the collection (via pointers), etc. I feel like someone's taken away my ferrari and given me a hugo. :-) Specifically, all I want to do is to be able to grab the last history record of type modifyObject for a given object. Since I want the most recent one, it just seems silly to have to start from the beginning and work my way through to the last one, y'know? As for looping in reverse and how to figure out how to order items, huh??? The order of the items in the collection would not change. It's just that you would start at the end and go backwards. Something akin to: for historyRec in obj step -1 { if (historyRec.type == modifyObject) { // Found it! Now go do whatever with it and exit the loop. } } Robin ------------------------- -------------------------------------- Robin Riley Motorola, Inc Robin.Riley@motorola.com |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.