Exemplo n.º 1
0
        /// <summary>
        /// Returns the product of the this efficacy set with another one.
        /// </summary>
        public EfficacySet Product(EfficacySet other)
        {
            var product = new EfficacySet();

            var allTypeIds = GetIds().Union(other.GetIds());

            foreach (var typeId in allTypeIds)
            {
                var first  = GetEfficacy(typeId);
                var second = other.GetEfficacy(typeId);

                if (first.HasValue && second.HasValue)
                {
                    product.Add(typeId, first.Value * second.Value);
                }
                else if (first.HasValue)
                {
                    product.Add(typeId, first.Value);
                }
                else if (second.HasValue)
                {
                    product.Add(typeId, second.Value);
                }
            }

            return(product);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the given efficacy in the version group with the given ID.
        /// </summary>
        public void SetEfficacySet(int versionGroupId, EfficacySet efficacy)
        {
            EfficacySets.RemoveAll(m => m.Id == versionGroupId);

            var mapping = new WithId <EfficacySet>(versionGroupId, efficacy);

            EfficacySets.Add(mapping);
        }