Hi, I would like to know if there's a standard tree structure where each node is a TObject. With "standard" I mean, in a standard package, like fcl-base.
Leonardo M. Ramé
http://leonardorame.blogspot.com

Mailing lists / fpc-pascal / 2013-02
15 messages · 7 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi, I would like to know if there's a standard tree structure where each node is a TObject. With "standard" I mean, in a standard package, like fcl-base.
Leonardo M. Ramé
http://leonardorame.blogspot.com
Leonardo M. Ramé wroteHi, I would like to know if there's a standard tree structure where each node is a TObject. With "standard" I mean, in a standard package, like fcl-base.
there is one in the generics. But not as a regular class.
Michael.
Hi, I would like to know if there's a standard tree structure where each node is a…
FCL_base does have one: avl_tree
but so does LCL, which is named AvgLvlTree (found in LazUtils)
I hope that helps... ;)
Kind regards,
Torsten Bonde Christiansen.
Does not allow multiple children, only left/right, no ?
Michael.
True - but the original question gives no hint to whether this is desired or not... :)
-Torsten.
Does not allow multiple children, only left/right, no ? Michael.
Isn't that a balanced binary tree? I'm looking for a simple tree structure (http://en.wikipedia.org/wiki/Tree_%28data_structure%29)
Leonardo M. Ramé
http://leonardorame.blogspot.com
there is one in the generics. But not as a regular class. Michael.
----- Original Message -----
Which one?.
Leonardo M. Ramé
http://leonardorame.blogspot.com
Isn't that a balanced binary tree? I'm looking for a simple tree structure…
Leonardo M. Ramé wroteIsn't that a balanced binary tree? I'm looking for a simple tree structure (http://en.wikipedia.org/wiki/Tree_%28data_structure%29)
It should be rather simple to create. A simple Composite design pattern and about 30-45 minutes with some accompanied unit tests, and you should have everything you want.
Regards,
- Graeme -
----- Original Message ----- Which one?. Leonardo M. Ramé…
----- Original Message -----
Well, I think TAvlTree fits the bill.
Leonardo M. Ramé
http://leonardorame.blogspot.com
Isn't that a balanced binary tree? I'm looking for a simple tree structure…
You could take a look at $fpcdir/packages/fcl-stl/gtree.pp (only in 2.7.1).
Regards,
Sven
Ah... finally somebody needs it. Please use the gtree unit, I would like to see whether it's really worth developing the unit for other people (than myself) :)
----- Original Message -----
Hi Leledumbo, I think it will work. I take the opportunity to ask you for a little example on how can I traverse a nested tree, I need this for populating a TTreeView from a generic TTree.
Leonardo M. Ramé
http://leonardorame.blogspot.com
I can't find the unit gtree...where is it located or downloadable from ?
Thanks,
R#
2013/2/13 Leonardo M. Ramé
Roberto P. wroteI can't find the unit gtree...where is it located or downloadable from ?
If you have a current checkout of FPC's trunk or a recent snapshot the unit is located in $fpcsr/packages/fcl-stl/src. It's currently only provided in trunk.
Regards,
Sven
I can't find the unit gtree...where is it located or downloadable from ? R# 2013/2/13…
In <FPC SOURCES>/packages/fcl-stl/src you'll have to update your svn trunk repository.
Leonardo M. Ramé
http://leonardorame.blogspot.com