On 20/10/2009, Paul Ishenin <i...@kmiac.ru> wrote: > > I don't like non-constructive criticism. If you don't like something please > be ready to suggest something instead. And in this case something what can
By no means to I suggest that my code should be the final product, but here I am attaching what I wrote for the Iterator article I previously mentioned. Please read the accompanied article as to why I did what I did. Due to the iterators not being part of the internal list classes and because I did not what to create descendant list classes for everything, I followed the following approach. I have used a Factory method to determine which Iterator should be returned, based on the class type in question. I have also not implement all suggested iterator interface methods - only a select few are currently implement. I also followed the Java iterator principle (different from Microsoft's idea) that the iterator pointer points between elements and NOT at elements. This make a lot more sense to me when you start the iteration (currently pointing at nothing because the list could be empty) and when you do things like inserting elements. Please see attached code. Note: If iterators get integrated with all list classes, then the factor method could disappear and a few other stuff could be simplified. -- Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/
iterator_source.tar.gz
Description: GNU Zip compressed data
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel