#32439 [Opn->WFx]: SPL: RecursiveIteratorIterator is not general enough
ID: 32439
Updated by: helly@php.net
Reported By: Peter dot Albertsson at naturesown dot se
-Status: Open
+Status: Wont fix
Bug Type: Feature/Change Request
-Operating System: SuSE Linux 9.1
+Operating System: *
-PHP Version: 5.0.3
+PHP Version: 5.*
Assigned To: helly
New Comment:
Directions:
1. Depth first or - we have that
2. Breadth first - that would insult full caching o fthe results which
contradicts the ide of Iterators. If you want this do it in userland.
For example you can use the function iterator_to_array() that is
available in 5.1.
combined with one of:
1. Left to right
2. Right to left
Both require that the thing works on a tree structure - well we don't
have a tree structure or object. And even if we had we would provide
some tree walker methods and of course won't use the iterator stuff.
If you now you think you need tree's and everythink feel free to check
out extension adt and get it fixed.
sorry nothing we can do atm.
Previous Comments:
------------------------------------------------------------------------
[2005-03-24 02:09:13] Peter dot Albertsson at naturesown dot se
Description:
------------
The RecursiveIteratorIterator is not flexible enough when it comes to
iterating trees. I also find some modes it operates in unneccasary.
I would like to choose in which directions the iterator iterates
through trees:
1. Depth first or
2. Breadth first
combined with one of:
1. Left to right
2. Right to left
As the iterator is implemented today, it lacks the method of iterating
breadth first. Instead I'm giving these options:
- RIT_LEAVES_ONLY: very easy to implement by oneself, by checking if
the node is a leaf node.
- RIT_SELF_FIRST: This one I would consider the default option. but it
is not.
- RIT_CHILD_FIRST: OK.. got to admit that I don't even understand this
one...
Most importantly, and I repeat, it lacks the option to iterate breadth
first, which is required by many standard algorithms.
Best Regards,
Peter Albertsson
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32439&edit=1
Thread (4 messages)