May 08, 2024, 12:50:39 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Question for Larry (McCaughn) about his Linked List Libary

Started by pistol350, August 28, 2008, 05:56:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

Hello Larry!

Using your Library, I just wondered how to read data at a given position in a list.
I may be wrong but it seemed to me that none of the commands receive parameters.
I meant parameters to set a given position.
I know that you can move through the list using the Get(First/Last/ Prev/Next) commands then use the ReadData one to access the data in the current node.
But how to know which node of the list it is and more importantly how to set the position of the node to be read?

Actually i was searching for an equivalent for Ebasic's ListGetData command.
Regards,

Peter B.

LarryMc

My linked list does not have an equivalent of the ListGetData
You can read the point with the class member:
Quotem_pCurPos   pointer   Protected - An internal pointer to the currently selected node in the list.
but you can't do anything with it.
Looks like a feature oversight on my part.
I already have a ReadData so I need to make a ReadDataPos
I'll put it on my list of things to do.

Currently I'm working on my custom button control library which will let you create buttons with over 200 shapes(as of today); solid colors/gradient colors(multiple zones)/bitmaps.  Along with that is a designer that lets you pick and choose all the options and then generates the necessary coding for you.

So I'll have to finish it before I mess with the Linked List again.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

pistol350

Ok Larry thank you for answering.

Like many others i am looking forward to seeing your other projects complete.
Regards,

Peter B.

LarryMc

I know I'm slow as mud but that's what chronic fatique does to you with a bad ticker.

But, I woke up this morning so I'm having a GREAT day! ;D

So, are you telling me if I add that feature you'll use my linked-list?
Hate to go to the trouble and noone use it.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

pistol350

I said i would and i do use it. 8)
I've been trying something lately using the linked list library.
In fact i thought i could use datas in a linked list to solve my Sprite Z order problem i talked about not long ago.
The idea to iterate through the linked list and determine which data should be displayed first and so on woks great for me.
That's what i currently use the linked liist for.But there is a wide range of things i can use the linked list for.
So don't worry about it to be useful or not as it is obviously very useful.

Thanks again for sharing your work
Regards,

Peter B.

Guilect

@pistol350,

could you share your linked list sorting routine?
Please.   :)

pistol350

Hi Guilect!

Do you mean my routine in the context of the Sprite Z order stuff ?
Regards,

Peter B.

Guilect

@pistol350,

precisely.

I have been thinking of doing something like that myself.
I thought of using a bubble sort method.
It would be great to see what you did.

Boris

Thank you for not breeding

LarryMc

Pete
Are you still needing another function added to my LinkedList class?

From the preceding discussion as I understood it:
you were wanting a function that would allow you to plug in the pointer to a node and have it return the data associated with that node.

The pointer value you would plug in would be obtained at some previous time using the GetFirst/Last/Next/Prev functions and storing that value somewhere of your choice.

Is that correct?

Larry

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

pistol350

Regards,

Peter B.

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

pistol350

Regards,

Peter B.

LarryMc

Pete

Got a functional question.

There's 2 ways I can accomplish the request.

1.  get data from desired node without any impact on the list's current node pointer
(means if you are in the middle of some getnext loop you could interrupt the loop to go get data with the previously stored pointer then resume th getnext where you left off.)

2. get data from the desired node and at the same time set the list's current node pointer to that particular node.
(means the next getnext or getprev would start at that node you forced it to.)


3. I could do both.
   getdatapos(pos)
   getdataposmove(pos)


What do you think?
What best serves people's needs?

Paul's doesn't move the current node pointer as such.#1

Is there any advantage to having #2 ?

There is defintely a danger to do #2.
Since it would change the current node pointer you could very easily send the program off into never-never land
by passing it a node pointer for a node that had been deleted for some reason.

I hesitate to implement it for that reason.  I'm looking for a good argument to add #2.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

pistol350

Sorry for not answering earlier.

err, i have to admit that this question is quite relevant.
Well, i think that number 1 is what everyone would be after for a simple use of Lists' capabilities.
However number 2 can also be useful depending on the project people are dealing with.
As far as i am concerned, number 1 may do the job.

Thanks again for spending  time on this.
Regards,

Peter B.