0

I need a cursor tree and I found CURSOR_TREE and RECURSIVE_CURSOR_TREE classes in EiffelStudio but they are deferred and I don't know how to implement them. Isn'it strange?

B3nTek
  • 7
  • 6

1 Answers1

0

Source code of some classes implementing CURSOR_TREE is available in your installation in .../library/base/elks/structures/cursor_tree. Unfortunately, the classes (as they were implemented) are incompatible with void safety. You can try copying the following classes to your project and compile:

library/base/elks/structures/cursor_tree/compact_cursor_tree.e
library/base/elks/structures/cursor_tree/linked_cursor_tree.e
library/base/elks/structures/cursor_tree/two_way_cursor_tree.e
library/base/elks/structures/cursors/compact_tree_cursor.e
library/base/elks/structures/cursors/linked_cursor_tree_cursor.e
library/base/elks/structures/cursors/two_way_cursor_tree_cursor.e

The process would involve several changes:

  • your project void safety capability should be set to none (and the project should be recompiled from scratch);

  • depending on the version of the compiler you may need to fix some validity errors in the library classes (e.g., remove put_right from redefine clauses);

  • implementations of the feature new_cursor have to be provided, a quick-and-dirty fix could be a dummy stub:

    new_cursor: ITERATION_CURSOR [G]
        do
            Result := (create {SPECIAL [G]}.make_empty (0)).new_cursor
        end
    

After that you should be able to use effective classes COMPACT_CURSOR_TREE, LINKED_CURSOR_TREE and TWO_WAY_CURSOR_TREE.

I would suggest collaborating with Eiffel Software if you plan to use the classes in a void-safe project because the implementation and the interface requires substantial changes to make the code void-safe.

Alexander Kogtenkov
  • 5,770
  • 1
  • 27
  • 35
  • I will work on them trying to get something useful, but this lack is very strange. ps - RECURSIVE_CURSOR_TREE is deferred too. – B3nTek Dec 19 '19 at 12:00
  • @B3nTek Indeed, I meant `linked_cursor_tree.e`. Thanks for the correction. – Alexander Kogtenkov Dec 19 '19 at 15:36
  • @B3nTek I would start with `LINKED_CURSOR_TREE` version to get the feeling what's wrong with the implementation and how it could be fixed. As soon as you have some ideas about that, constructive collaboration with Eiffel Software should be possible. – Alexander Kogtenkov Dec 19 '19 at 15:52