[jdom-interest] Having a ListIterator as child cursor ??
Paul Libbrecht
paul at ags.uni-sb.de
Wed Nov 21 15:15:24 PST 2001
Hi JDOMmers,
As mentionned in my earlier mails about events (or recipes), a delicate
problem with Jdom is to be given an element object and wanting to remove
that element, to replace it, to remove its neighbour or anything such...
I suggested to have an int getPositionInParent()... maybe this is a bit
crazy...
An alternative would be to have method like ListIterator
getCursorInParentContent() for all the "nodes" object (e.g. those that can
be added as content) that would return a listIterator positionned at that
element.
It would still require the children to know their positions and the update
of such would still require some shifts each time a child-node is added
(at least as long ArrayList is used, using something like GapVector would
lower the updates by a good amount, LinkedList would have no problem), but
it would be way more expressive and directly useful:
to remove: node.getCursorInParentContent().remove()
to replace: node.getCursorInParentContent().set(newNode)
// with a subclassing to call setParent
and so on...
Is this non-reasonnable ??
Thanks.
Paul
More information about the jdom-interest
mailing list