TreeIterator

Hi

There is a problem with TreeIterator being derived from NodeIterator.
A TreeIterator is initialized with a node. Because it is a NodeIterator,
the
inherited operations talk about the children of the initialization node.
That
means the TreeIterator operations numChildren, toFirstChild, toLastChild
and
toNthChild have no meaning. The NodeIterator operations getLength,
toFirstNode,
toLastNode and moveTo provide the intended meaning respectively.

If this interpretation is wrong then the TreeIterator is a NodeIterator
over
the children of the parent node of the initialization node, that happens
to be
positioned at the initialization node. In that case the operations
toPreviousSibling and toNextSibling have no meaning. The NodeIterator
operations toPrevNode and toNextNode provide the intended meaning
respectively.

In any case, the additional operations should have the same, new,
semantics
regarding iterator position the inherited operations have.

If TreeIterator must inherit from NodeIterator the only additional
operations
that are needed in it are "up" and "down". These add tree navigation to
a
NodeIterator. The up operation is what toParent is now. The down
operation goes
one level deeper through the node the iterator is now positioned in
front of.
The new state of the iterator is the same as if it were initialized with
the
node the iterator was positioned in front of in the old state.

Regards,
-- 
Werner Donné
Re BVBA
Leuvenselaan 172
B-3300 Tienen
tel: (+32) 16 810203
fax: (+32) 16 820826
E-mail: wdonne@ibm.net

Received on Monday, 20 April 1998 08:31:21 UTC