# File lib/dnstraverse/referral.rb, line 242
    def answer_calculate
      Log.debug { "Calculating answer: #{self}" }
      @stats = Hash.new
      
      if not @server then
        # special case - rootroot, no actual IPs, just root referrals
        stats_calculate_children(@stats, @children[:rootroot], 1.0)
        @stats.each_pair do |key, data|
          Log.debug { sprintf "Answer: %.2f%% %s\n", data[:prob] * 100, key }
        end
        return
      end
      for ip in @serverips do
        serverweight = @serverweights[ip] # set at initialize or at resolve
        if ip =~ /^key:/ then # resolve failed for some reason
          # pull out the statistics on the resolution and copy over
          raise "duplicate key found" if @stats[ip] # assertion
          if @stats_resolve[ip][:prob] != serverweight then # assertion
            $stderr.puts "#{@stats_resolve[ip][:prob]} vs #{serverweight}"
            @stats_resolve[ip].each_pair do |a,b|
              $stderr.puts a
            end
            raise "unexpected probability" 
          end
          @stats[ip] = @stats_resolve[ip].dup
          next
        end
        if @children[ip] then
          stats_calculate_children(@stats, @children[ip], serverweight)
        else
          response = @responses[ip]
          @stats[response.stats_key] = { :prob => serverweight,
            :response => response, :referral => self }
        end
      end
      @stats.each_pair do |key, data|
        Log.debug { sprintf "Answer: %.2f%% %s\n", data[:prob] * 100, key }
      end
    end