def each
      # We use a non-recursive implementation to traverse the tree. This stack
      # keeps track of all the known still to be checked nodes.
      stack = [ [ self, :on_enter ] ]

      while !stack.empty?
        node, mode = stack.pop

        # Empty trees only have a dummy node that has no parent, and a size
        # and address of 0.
        break if node.size == 0 && node.blob_address == 0 && node.parent.nil?

        case mode
        when :on_enter
          yield(node, mode, stack)
          stack.push([ node, :smaller ])
        when :smaller
          yield(node, mode, stack) if node.smaller
          stack.push([ node, :equal ])
          stack.push([ node.smaller, :on_enter]) if node.smaller
        when :equal
          yield(node, mode, stack) if node.equal
          stack.push([ node, :larger ])
          stack.push([ node.equal, :on_enter]) if node.equal
        when :larger
          yield(node, mode, stack) if node.larger
          stack.push([ node, :on_exit])
          stack.push([ node.larger, :on_enter]) if node.larger
        when :on_exit
          yield(node, mode, stack)
        end
      end
    end
def each
      # We use a non-recursive implementation to traverse the tree. This stack
      # keeps track of all the known still to be checked nodes.
      stack = [ [ self, :on_enter ] ]

      while !stack.empty?
        node, mode = stack.pop

        # Empty trees only have a dummy node that has no parent, and a size
        # and address of 0.
        break if node.size == 0 && node.blob_address == 0 && node.parent.nil?

        case mode
        when :on_enter
          yield(node, mode, stack)
          stack.push([ node, :smaller ])
        when :smaller
          yield(node, mode, stack) if node.smaller
          stack.push([ node, :equal ])
          stack.push([ node.smaller, :on_enter]) if node.smaller
        when :equal
          yield(node, mode, stack) if node.equal
          stack.push([ node, :larger ])
          stack.push([ node.equal, :on_enter]) if node.equal
        when :larger
          yield(node, mode, stack) if node.larger
          stack.push([ node, :on_exit])
          stack.push([ node.larger, :on_enter]) if node.larger
        when :on_exit
          yield(node, mode, stack)
        end
      end
    end
Depth-first iterator for all nodes. The iterator yields the given block
 at 5 points for any found node. The mode variable indicates the point.
 :on_enter Coming from the parent we've entered the node for the first
           time
 :smaller We are about to follow the link to the smaller sub-node
 :equal We are about to follow the link to the equal sub-node
 :larger We are about to follow the link to the larger sub-node
 :on_exit We have completed this node