def get_unit(key)
    return 0.0 if source_factories.empty?
    sum = total_weight = 0.0
    source_factories.each do |factory|
      weight = weights[factory] || 1.0
      sum += factory.get_unit(key) * weight
      total_weight += weight
    end
    return 0.0 if total_weight == 0
    sum / total_weight
  end
def get_unit(key)
    return 0.0 if source_factories.empty?
    sum = total_weight = 0.0
    source_factories.each do |factory|
      weight = weights[factory] || 1.0
      sum += factory.get_unit(key) * weight
      total_weight += weight
    end
    return 0.0 if total_weight == 0
    sum / total_weight
  end
Takes a hash with all keys supported by Factory, plus these keys and defaults:
  :weights => {}
Calls #get_unit(key) on each source factory and multiples value by weight.
Then divides total of values by total weight to get weighted average.