Exemplo n.º 1
0
 public bool containsAll(IngredientList other)
 {
     foreach (String key in other.Keys)
     {
         if (other[key].Equals(1) && !this[key].Equals(1))
         {
             return(false);
         }
     }
     return(true);
 }
        public double minSquaredDist(IngredientList listA, IngredientList listB)
        {
            double sum = 0;
            IEnumerable <String> keys = getTempVectorSpace(listA, listB);

            foreach (String key in keys)
            {
                sum += Math.Pow(((int)listA[key]) - ((int)listB[key]), 2);
            }

            return(Math.Sqrt(sum));
        }
 private IEnumerable <String> getTempVectorSpace(IngredientList listA, IngredientList listB)
 {
     return(listA.Keys.Union(listB.Keys));
 }