Example #1
0
 public virtual void AdjustNutrients(NutrientSet target)
 {
     // Probably should change NutrientSet type to inherit directly or implement IEnumX
     foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Impact)
     {
         NutrientAmount val = 0;
         target.TryGetValue(kvp.Key, out val);
         target[kvp.Key] = val + kvp.Value;
     }
 }
Example #2
0
 public void AdjustNutrients(NutrientSet target)
 {
     // Probably should change NutrientSet type to inherit directly or implement IEnumX
     foreach (KeyValuePair <Nutrient, NutrientAmount> kvp in Parent.Nutrients)
     {
         // Switch Dictionary Type to Concurrent?
         NutrientAmount val = 0;
         target.TryGetValue(kvp.Key, out val);
         target[kvp.Key] = val + kvp.Value;
     }
 }
Example #3
0
 public float RatioRDV(NutrientAmount amount)
 {
     if (DailyTarget == null)
     {
         return(1f);
     }
     if (amount == null)
     {
         return(0f);
     }
     return((float)(amount / DailyTarget));
 }