src/doc: introduce option --no-render in HTML phase.
[nit.git] / lib / trees / bintree.nit
index d11898f..610ec2e 100644 (file)
@@ -64,7 +64,7 @@ class BinTreeMap[K: Comparable, E]
        #     assert not tree.has_key(0)
        #     assert tree.has_key(2)
        #     assert not tree.has_key(6)
-       redef fun has_key(key: K): Bool do
+       redef fun has_key(key) do
                if is_empty then return false
                var res = search_down(root.as(not null), key)
                if res != null then
@@ -85,7 +85,7 @@ class BinTreeMap[K: Comparable, E]
        #     assert tree[1] == "n1"
        #     assert tree.has_key(1)
        #     assert tree[2] == "n2"
-       redef fun [](key: K): E do
+       redef fun [](key) do
                assert not_empty: not is_empty
                if cache_node != null and cache_node.key == key then return cache_node.value
                var res = search_down(root.as(not null), key)
@@ -94,7 +94,8 @@ class BinTreeMap[K: Comparable, E]
        end
 
        # Search `key` in `from` and its children nodes.
-       protected fun search_down(from: N, key: K): nullable N do
+       protected fun search_down(from: N, key: nullable Object): nullable N do
+               if not key isa Comparable then return null
                var cmp = key <=> from.key
                if cmp == 0 then return from
                if from.left != null and cmp < 0 then
@@ -339,7 +340,7 @@ class BinTreeMap[K: Comparable, E]
 
        redef fun show_dot do
                assert not_empty: root != null
-               var f = new OProcess("dot", "-Txlib")
+               var f = new ProcessWriter("dot", "-Txlib")
                f.write "digraph \{\n"
                dot_down(root.as(not null), f)
                f.write "\}\n"
@@ -347,7 +348,7 @@ class BinTreeMap[K: Comparable, E]
        end
 
        # Translate the tree in dot format starting from `node`.
-       protected fun dot_down(node: N, f: OProcess) do
+       protected fun dot_down(node: N, f: ProcessWriter) do
                if node.left != null then dot_down(node.left.as(not null), f)
                f.write node.to_dot
                if node.right != null then dot_down(node.right.as(not null), f)