Re: [fpc-pascal] Tree structure

2013-02-12 Thread Michael Van Canneyt



On Tue, 12 Feb 2013, Leonardo M. Ramé wrote:


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.


there is one in the generics.  But not as a regular class.

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Tree structure

2013-02-12 Thread Torsten Bonde Christiansen

On 2013-02-12 16:13, Leonardo M. Ramé wrote:
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


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Tree structure

2013-02-12 Thread Michael Van Canneyt



On Tue, 12 Feb 2013, Torsten Bonde Christiansen wrote:


On 2013-02-12 16:13, Leonardo M. Ramé wrote:
  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


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


FCL_base does have one: avl_tree


Does not allow multiple children, only left/right, no ?

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Tree structure

2013-02-12 Thread Torsten Bonde Christiansen

On 2013-02-12 16:36, Michael Van Canneyt wrote:



On Tue, 12 Feb 2013, Torsten Bonde Christiansen wrote:


On 2013-02-12 16:13, Leonardo M. Ramé wrote:
  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


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


FCL_base does have one: avl_tree


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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé

 From: Michael Van Canneyt mich...@freepascal.org
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org 
Sent: Tuesday, February 12, 2013 12:36 PM
Subject: Re: [fpc-pascal] Tree structure
 


On Tue, 12 Feb 2013, Torsten Bonde Christiansen wrote:

 On 2013-02-12 16:13, Leonardo M. Ramé wrote:
       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
 
 
 FCL_base does have one: avl_tree

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

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé
- Original Message -

 From: Michael Van Canneyt mich...@freepascal.org
 To: Leonardo M. Ramé martinr...@yahoo.com; FPC-Pascal users discussions 
 fpc-pascal@lists.freepascal.org
 Cc: 
 Sent: Tuesday, February 12, 2013 12:28 PM
 Subject: Re: [fpc-pascal] Tree structure
 
 
 
 On Tue, 12 Feb 2013, Leonardo M. Ramé wrote:
 
  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.
 
 there is one in the generics.  But not as a regular class.
 
 Michael


Which one?.

 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Graeme Geldenhuys
On 2013-02-12 15:44, Leonardo M. Ramé wrote:
 
 Isn'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 -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Leonardo M . Ramé
- Original Message -

 From: Leonardo M. Ramé martinr...@yahoo.com
 To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
 Cc: 
 Sent: Tuesday, February 12, 2013 12:45 PM
 Subject: Re: [fpc-pascal] Tree structure
 
 - Original Message -
 
  From: Michael Van Canneyt mich...@freepascal.org
  To: Leonardo M. Ramé martinr...@yahoo.com; FPC-Pascal users 
 discussions fpc-pascal@lists.freepascal.org
  Cc: 
  Sent: Tuesday, February 12, 2013 12:28 PM
  Subject: Re: [fpc-pascal] Tree structure
 
 
 
  On Tue, 12 Feb 2013, Leonardo M. Ramé wrote:
 
   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.
 
  there is one in the generics.  But not as a regular class.
 
  Michael
 
 
 Which one?.
 
 

Well, I think TAvlTree fits the bill.


 
Leonardo M. Ramé
http://leonardorame.blogspot.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Tree structure

2013-02-12 Thread Sven Barth

On 12.02.2013 16:44, Leonardo M. Ramé wrote:


From: Michael Van Canneyt mich...@freepascal.org
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Tuesday, February 12, 2013 12:36 PM
Subject: Re: [fpc-pascal] Tree structure



On Tue, 12 Feb 2013, Torsten Bonde Christiansen wrote:


On 2013-02-12 16:13, Leonardo M. Ramé wrote:
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


FCL_base does have one: avl_tree


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)


You could take a look at $fpcdir/packages/fcl-stl/gtree.pp (only in 2.7.1).

Regards,
Sven

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal