Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Skip Ordering
Topic Summary:
Created On: 4-Dec-2007 19:13
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 4-Dec-2007 19:13
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Did some tests on the order in which information is stored in Skip lists. As you know, after inserting the elements, the "for Data in skp do" loop should retrieve the information in the Skip in KEY sorted order. The attached DXL produces the results posted below.

Names3 uses the 'int' as the KEY, and they are retrieved in KEY (int) order (1,2,3). Names1 and Names2 use the 'string' as the KEY. The difference between Names1 and Names2 is simply that Names1 is create via 'create()' (line 1), and Names2 uses 'createString()' (line 2). I notice that Names2 are retrieved in KEY (alpha) order (A,B,C), but Names1 are retrieved in insert order (B,A,C).

I conclude that you should routinely use 'createString' for skips that have a string as the KEY, and use 'create' for all other skips; unless for sure you know what you are doing.

I don't know what to think about the difference in the processing, however. Perhaps its just a coincedence that Names1 are retrieved in insert order ..err.. perhaps because the addresses used are sequencial in memory.


** RESULTS OF DXL FOLLOW **
Names1:
1 B
3 A
2 C
Names2:
3 A
1 B
2 C
Names3:
1 B
2 C
3 A
Report this to a Moderator Report this to a Moderator
 4-Dec-2007 19:25
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Just FYI from the DXL Reference Manual.

The keys used with the skip list can be of any type. However, comparison of keys is based on the address of the key, not its contents. This is fine for elements that are always represented by a unique pointer, for example, objects, modules, or skip lists, but care is needed with strings. This is because a string may not have a unique address, depending on whether it is literal or a computed string stored in a variable.

There are two ways of avoiding this problem. The first is to use the createString form of the function for a skip list with a string key. The alternative is to ensure that all literal strings used as keys are concatenated with the empty string.




-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 4-Dec-2007 22:05
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Yes I read that. So I added a 4th skip which inserted the string concatenated with an empty string, and the results were different than any of the other 3; display order was in reverse of insert order.

Don't recall much about my direct-indirect-descripter course back in the "Amish University of Computer Black Magic Technology" (final was in punch-cards), but I suppose I may have been able to figure this out if I thought about it back then.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.