From: Eric B. <er...@go...> - 2001-06-27 18:01:29
|
Einar Karttunen wrote: >=20 > I think of inheriting from DS_CONTAINER=2E DS_TRAVERSABLE presents > problems as trees can be traversed in many orders=2E I plan to include > pre-, post-, inorder and Lindst=F6m-traversing=2E You could arbitrarily choose one of them to implement the routines from DS_TRAVERSABLE and provide other external cursors for the other kind of traversals=2E For example: new_cursor: DS_TREE_CURSOR [G] is -- New external cursor for traversal -- (Use preorder traversal by default=2E) do Result :=3D new_preorder_cursor end new_preorder_cursor: DS_PREORDER_TREE_CURSOR [G] is -- New external cursor for preorder traversal do !! Result=2Emake (Current) ensure =2E=2E=2E end new_postorder_cursor: DS_POSTORDER_TREE_CURSOR [G] is -- New external cursor for postorder traversal do !! Result=2Emake (Current) ensure =2E=2E=2E end =2E=2E=2E --=20 Eric Bezault mailto:ericb@gobosoft=2Ecom http://www=2Egobosoft=2Ecom |