RE: Alternative to the Live NodeIterator

> -----Original Message-----
> From: Peter Sharpe
> Subject: RE: Alternative to the Live NodeIterator
 . . .
> Any object which contains a reference to one or more nodes in the tree will
> have
> to be "maintained" during editing operations. There are many ways
> to implement
> this, obviously, but one way, conceptually at least, is to have methods like
> beforeDelete(Node nodeBeingDeleted), afterInsert(Node
> nodeBeingInserted), etc.
> If you implement your iterators as a linked list then on a Node delete
> operation
> you can call
>   myIteratorClass::beforeDelete(Node nodeBeingDeleted) {
>     if nodeBeingDeleted is something I reference then
>        fix up my reference by finding an appropriate node that will still
>        be around after nodeBeingDeleted is gone.
>     }
>     nextIterator()->beforeDelete(nodeBeingDeleted);
>   }


Yes.  This is an excelent way to create the iterator class proposed in the
spec.  In fact, this is very similar to the Visitor model Don Park mentioned.

My point is it requires the document tree to have a reference to the Iterator
so this update can be made.  And as Don Park also mentioned, these reference
need a release mechanism.



Andrew n marshall
  student - artist - programmer
     http://www.media-electronica.com/anm-bin/anm
      "Everyone a mentor, Everyone a pupil"

Received on Friday, 1 May 1998 12:23:42 UTC