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: ListView insertion
Topic Summary: Duplicate entries
Created On: 8-Oct-2008 15:40
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.
Answer This question was answered by David Pechacek, on Wednesday, October 8, 2008 4:48 PM

Answer:
Agree with Scott. A skip list is the easiest way to prevent duplicates in the list. Just remember to delete it when finished.
 8-Oct-2008 15:40
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Hi all,

I have written a script that loops through a number of modules and checks against certain attributes. When a match is found I wish to populate a list/listview with the matched module names. This is functioning OK except for the inclusion of duplicate entries.

The DXL Ref manual specifies Inserts a new value into element at position index. The argument element can be a choice, tab strip, list, multi-list, combo box, or list view. Positions start at zero; when a new element is inserted all the other values are moved up. This function inserts duplicate values if they are specified.

Is there any way of checking the existing list or will it be necessary to populate a Skip list with the matched modules and then use that to insert the results into the list view to ensure unique entries

Thanks

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 15:49
User is offline View Users Profile Print this message


Scott Boisvert

Posts: 348
Joined: 14-Apr-2006

I personally think adding the modules to a skip list using their unique names, and then looping through the skip list to add them to the list or listview would be the most efficient method. But if you don't want to do that, you could do something like this for each module you need to add:

-------------------------
Scott Boisvert
Engineering Tools Administrator
L-3 Communications - Avionics Systems
scott.boisvert@l-3com.com

Edited: 8-Oct-2008 at 15:55 by Scott Boisvert
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 16:04
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Answer Answer
Agree with Scott. A skip list is the easiest way to prevent duplicates in the list. Just remember to delete it when finished.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 16:21
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Thanks guys,

I must be getting a small handle on this DXL lark as that is conclusion I had come to. However I do not have much success with Skip lists generally.

Cheers

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 17:35
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

For skip lists you must decide the types of variables for both the 'KEY' and the 'DATA'. Since I get confused easily I always specify that in the declaration of the skip, e.g.:

Skip skpObjects // KEY: 'string' AbsNo; DATA: 'Object' handle.

I suppose some real clever folks can find a way to use different variable types in the Skip; but lets not go there.

If the KEY is type 'string' then be sure to create the skip with 'createString', e.g.:

skpObjects = createString()

If the KEY is any other type create it with 'create()'.

If you 'put' into a skip and the key already exists, the input put is ignored and the skip is unchanged.

Getting things out of a skip means looping through the DATA. You then would routinely derive the KEY in the next line, e.g.

for obj in skpObjects do
{ string AbsNo = (string key skpObjects)
... deal with obj and AbsNo
}

Be sure to delete the skip when done; e.g. delete(skpObjects).

If you store data structures inside the skip; perhaps the DATA is type Skip or Buffer, then you should delete each such embedded Skip or Buffer before deleting the parent Skip list. e.g.:

for buf in skpBuffers do
{ delete(buf)
}
delete skpBuffers

I wonder why these things are called 'Skip' lists...

- Louie
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 17:41
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Sounded good.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 18:13
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Louie, I would guess that Doctor William Pugh generated the name Skip List in 1989 because of the natures of a skip list as detailed below.


The skip list data structure is based on a sorted linked list. Extra links are added for most nodes, and allow the search to skip over much of the list. Excellent complexity is achieved for search and insert, in a probabilistic sense. That is, while any given search has a high probability of being efficient, there is a non-zero probability that it will be very inefficient. In the (extremely unlikely) degenerate case where each node has only a single link, search degenerates to linear search through a linked list.

During search, the longest (highest) links are followed first. Once the search has passed the place where the item we are seeking should be, we drop down to the next level of shorter links. We continue doing this until we are down at the bottom level. At this point, we know that the item should be the next node.

At this point, a search operation will either return the found node, or else return an unsuccessful search. An insertion operation will insert the node at this point.

Insertion requires us to allocate a new node, with a randomized number of links. The number of levels in a new node is determined by iterating through a loop whose body adds a new level with a certain probability. The loop terminates when a new level is not added. The new node is then linked into the list at each of its levels.

The probabilistic nature of skip list comes from the use of a randomization to determine the number of links from each node. While it is extremely unlikely that every node would have only a single link, this could happen, and search would degenerate to linear search.

The probability of adding a new link is a parameter that can be changed, and the change will affect the search. The lower the probability of adding a new level, the fewer high-level links there will be. Operationally this means that the skips will be longer at the higher levels, but that there will be more single-stepping at the bottom level.

Edited: 8-Oct-2008 at 18:36 by ron lewis
Report this to a Moderator Report this to a Moderator
 8-Oct-2008 18:37
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Thanks all for your valued contributions.

I have managed to create a skip and fill it with the results of my search. I then looped through the skip and now have the results list populated with no duplications.

Couldn't have done that a few weeks ago! Progress...

Cheers

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 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 1 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.