[fpc-devel] Re: [Lazarus] How to iterate through a TAvgLvlTree
marc.weustink at cuperus.nl
Thu Mar 22 10:31:16 CET 2012
Felipe Monteiro de Carvalho wrote:
> Can I add a routine to access the AvgLvlTree as an array? To make it a
> better substitute to TFPList in objects which offer an indirect
> interface to the internal list, such as TLazAccessibleObject.
> My idea is defining:
> Index zero = Tree.FindLowest
> Indez Count-1= Tree.FindHighest
> On each access store the last accessed node and if the next call wants
> a node index=oldindex+1 or -1 then just use:
> Because almost always I use the array access only to iterate in a loop.
Lazarus has a TMap implementations where a AvgLvlTree is used for
looking up items and has a own AvgLvlTreeItem which is a double linked
list so items can be iterated.
Tree.FindSuccessor(Node)/Tree.FindPrecessor(Node) can cause a lot of
> Non-ordened access ofcourse would be slow because it would require a
> loop till the index is found.
More information about the fpc-devel