Example #1
0
        /// <summary>
        /// Adds a value to the weighted list.
        /// </summary>
        /// <param name="weight">Weight of this value in the list.</param>
        public void Add(double weight, T value)
        {
            var listEntry = new WeightedValue <T> {
                Weight = weight, Value = value
            };

            _valueList.Add(listEntry);
            TotalWeight += weight;
        }
Example #2
0
 public void Add(WeightedValue <T> value)
 {
     Add(value.Weight, value.Value);
 }
Example #3
0
 protected bool Equals(WeightedValue <T> other)
 {
     return(EqualityComparer <T> .Default.Equals(Value, other.Value));
 }