• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Recipes.Recipe类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中KitchenPC.Recipes.Recipe的典型用法代码示例。如果您正苦于以下问题:C# Recipe类的具体用法?C# Recipe怎么用?C# Recipe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Recipe类属于KitchenPC.Recipes命名空间,在下文中一共展示了Recipe类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RecipeCreator

        public RecipeCreator(IKpcContext context)
        {
            this.context = context;
            this.recipe = new Recipe();

            this.recipe.DateEntered = DateTime.Now;
        }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:7,代码来源:RecipeCreator.cs


示例2: CategorizeMeal

        private static void CategorizeMeal(Recipe recipe, CategorizationResult result, Analyzer analyzer)
        {
            IRecipeClassification trainedRecipe;
            if (analyzer.CheckIfTrained(recipe.Id, out trainedRecipe))
            {
                result.MealBreakfast = trainedRecipe.IsBreakfast;
                result.MealLunch = trainedRecipe.IsLunch;
                result.MealDinner = trainedRecipe.IsDinner;
                result.MealDessert = trainedRecipe.IsDessert;
            }
            else
            {
                var analysis = analyzer.GetPrediction(recipe);

                result.MealBreakfast =
                    analysis.FirstPlace.Equals(Category.Breakfast) ||
                    analysis.SecondPlace.Equals(Category.Breakfast);
                result.MealLunch =
                    analysis.FirstPlace.Equals(Category.Lunch) ||
                    analysis.SecondPlace.Equals(Category.Lunch);
                result.MealDinner =
                    analysis.FirstPlace.Equals(Category.Dinner) ||
                    analysis.SecondPlace.Equals(Category.Dinner);
                result.MealDessert =
                    analysis.FirstPlace.Equals(Category.Dessert) ||
                    analysis.SecondPlace.Equals(Category.Dessert);
            }
        }
开发者ID:Derneuca,项目名称:KitchenPCTeamwork,代码行数:28,代码来源:CategorizationEngine.cs


示例3: RecipeRater

        public RecipeRater(IKPCContext context, Recipe recipe, Rating rating)
        {
            this.context = context;
            this.newRatings = new Dictionary<Recipe, Rating>();

            this.newRatings.Add(recipe, rating);
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:7,代码来源:RecipeRater.cs


示例4: RecipeClassification

        public RecipeClassification(Recipe recipe, RecipeTag tag)
        {
            this.Recipe = recipe;

            this.IsBreakfast = tag == RecipeTag.Breakfast;
            this.IsLunch = tag == RecipeTag.Lunch;
            this.IsDinner = tag == RecipeTag.Dinner;
            this.IsDessert = tag == RecipeTag.Dessert;
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:9,代码来源:RecipeClassification.cs


示例5: Add

        public MenuUpdater Add(Recipe recipe)
        {
            if (!this.addQueue.Contains(recipe))
            {
                this.addQueue.Add(recipe);
            }

            return this;
        }
开发者ID:Derneuca,项目名称:KitchenPCTeamwork,代码行数:9,代码来源:MenuUpdater.cs


示例6: Regex

        static readonly Regex valid = new Regex(@"[a-z]", RegexOptions.IgnoreCase); //All tokens have to have at least one letter in them

        #endregion Fields

        #region Methods

        public static IEnumerable<IToken> Tokenize(Recipe recipe)
        {
            var tokens = new List<IToken>();
             tokens.AddRange(ParseText(recipe.Title ?? ""));
             tokens.AddRange(ParseText(recipe.Description ?? ""));
             //tokens.AddRange(ParseText(recipe.Method ?? ""));
             //tokens.Add(new TimeToken(recipe.CookTime.GetValueOrDefault() + recipe.PrepTime.GetValueOrDefault()));
             tokens.AddRange(from i in recipe.Ingredients.NeverNull() select new IngredientToken(i.Ingredient) as IToken);

             return tokens;
        }
开发者ID:relimited,项目名称:core,代码行数:17,代码来源:Tokenizer.cs


示例7: RecipeBrief

 public RecipeBrief(Recipe recipe)
 {
     this.Id = recipe.Id;
     this.OwnerId = recipe.OwnerId;
     this.Title = recipe.Title;
     this.Description = recipe.Description;
     this.ImageUrl = recipe.ImageUrl;
     this.Author = recipe.OwnerAlias;
     this.PreparationTime = recipe.PreparationTime;
     this.CookingTime = recipe.CookingTime;
     this.AverageRating = recipe.AverageRating;
 }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:12,代码来源:RecipeBrief.cs


示例8: RecipeBrief

 public RecipeBrief(Recipe r)
 {
     this.Id = r.Id;
      this.OwnerId = r.OwnerId;
      this.Title = r.Title;
      this.Description = r.Description;
      this.ImageUrl = r.ImageUrl;
      this.Author = r.OwnerAlias;
      this.PrepTime = r.PrepTime;
      this.CookTime = r.CookTime;
      this.AvgRating = r.AvgRating;
 }
开发者ID:relimited,项目名称:core,代码行数:12,代码来源:RecipeBrief.cs


示例9: Categorize

        public CategorizationResult Categorize(Recipe recipe)
        {
            var result = new CategorizationResult();

             CategorizeMeal(recipe, result, analyzer);
             CategorizeDiet(recipe, result);
             CategorizeNutrition(recipe, result);
             CategorizeSkill(recipe, result);
             CategorizeTaste(recipe, result);

             return result;
        }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:12,代码来源:CategorizationEngine.cs


示例10: MockRecipe

        public static Recipe MockRecipe(string title, string desc, RecipeTags tags = null)
        {
            var ret = new Recipe(Guid.NewGuid(), title, desc, null);

            ret.Method = "This is a mock recipe.";
            ret.OwnerAlias = "Fake Owner";
            ret.OwnerId = Guid.NewGuid();
            ret.PermanentLink = "http://www.kitchenpc.com/123";
            ret.ServingSize = 5;
            ret.Tags = tags;

            return ret;
        }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:13,代码来源:Recipes.cs


示例11: Tokenize

        // What should IToken have? Should Token be a Generic Item<T>?
        public static IEnumerable<IToken> Tokenize(Recipe recipe)
        {
            var tokens = new List<IToken>();
            tokens.AddRange(ParseText(recipe.Title ?? string.Empty));
            tokens.AddRange(ParseText(recipe.Description ?? string.Empty));
            tokens.AddRange(ParseText(recipe.Method ?? string.Empty));
            tokens.Add(new TimeToken(recipe.CookTime + recipe.PrepTime));
            tokens.AddRange(
                recipe.Ingredients.NeverNull()
                    .Select(ingredientUsage => new IngredientToken(ingredientUsage.Ingredient)));

            return tokens;
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:14,代码来源:Tokenizer.cs


示例12: Add

 public void Add(Recipe recipe)
 {
     var tokens = Tokenizer.Tokenize(recipe);
     foreach (var token in tokens)
     {
         if (this.index.ContainsKey(token))
         {
             this.index[token]++;
         }
         else
         {
             this.index.Add(token, 1);
         }
     }
 }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:15,代码来源:RecipeIndex.cs


示例13: CategorizeDiet

        private void CategorizeDiet(Recipe recipe, CategorizationResult result)
        {
            var ingredientMeta = recipe.Ingredients.Select(ing => ing.Ingredient.Metadata).ToArray();

            var glutenFree = ingredientMeta.All(ing => ing.HasGluten == false);
            var noAnimals = ingredientMeta.All(ing => ing.HasAnimal == false);
            var noMeat = ingredientMeta.All(ing => ing.HasMeat == false);
            var noPork = ingredientMeta.All(ing => ing.HasPork == false);
            var noRedMeat = ingredientMeta.All(ing => ing.HasRedMeat == false);

            result.DietGlutenFree = glutenFree;
            result.DietNoAnimals = noAnimals;
            result.DietNoMeat = noMeat;
            result.DietNoPork = noPork;
            result.DietNoRedMeat = noRedMeat;
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:16,代码来源:CategorizationEngine.cs


示例14: CategorizeDiet

        static void CategorizeDiet(Recipe recipe, CategorizationResult result)
        {
            var ingmeta = (from ing in recipe.Ingredients select ing.Ingredient.Metadata).ToArray();

             var glutenFree = ingmeta.All(ing => ing.HasGluten == false);
             var noAnimals = ingmeta.All(ing => ing.HasAnimal == false);
             var noMeat = ingmeta.All(ing => ing.HasMeat == false);
             var noPork = ingmeta.All(ing => ing.HasPork == false);
             var noRed = ingmeta.All(ing => ing.HasRedMeat == false);

             result.Diet_GlutenFree = glutenFree;
             result.Diet_NoAnimals = noAnimals;
             result.Diet_NoMeat = noMeat;
             result.Diet_NoPork = noPork;
             result.Diet_NoRedMeat = noRed;
        }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:16,代码来源:CategorizationEngine.cs


示例15: GetPrediction

        public AnalyzerResult GetPrediction(Recipe recipe)
        {
            var winsBreakfast = new Ranking(Category.Breakfast);
            var winsLunch = new Ranking(Category.Lunch);
            var winsDinner = new Ranking(Category.Dinner);
            var winsDessert = new Ranking(Category.Dessert);

            // Setup Tournament
            this.Compete(recipe, this.breakfastIndex, this.lunchIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);
            this.Compete(recipe, this.breakfastIndex, this.dinnerIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);
            this.Compete(recipe, this.breakfastIndex, this.dessertIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);
            this.Compete(recipe, this.lunchIndex, this.dinnerIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);
            this.Compete(recipe, this.lunchIndex, this.dessertIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);
            this.Compete(recipe, this.dinnerIndex, this.dessertIndex, winsBreakfast, winsLunch, winsDinner, winsDessert);

            // Choose winner
            var result = GetWinner(winsBreakfast, winsLunch, winsDinner, winsDessert);
            return result;
        }
开发者ID:Derneuca,项目名称:KitchenPCTeamwork,代码行数:19,代码来源:Analyzer.cs


示例16: CategorizeMeal

        private void CategorizeMeal(Recipe recipe, CategorizationResult result)
        {
            IRecipeClassification trainedRecipe = this.analyzer.GetTrainedRecipe(recipe.Id);
            if (trainedRecipe != null)
            {
                result.MealBreakfast = trainedRecipe.IsBreakfast;
                result.MealLunch = trainedRecipe.IsLunch;
                result.MealDinner = trainedRecipe.IsDinner;
                result.MealDessert = trainedRecipe.IsDessert;
            }
            else
            {
                var analysis = this.analyzer.GetPrediction(recipe);

                result.MealBreakfast = analysis.FirstPlace.Equals(Category.Breakfast) || analysis.SecondPlace.Equals(Category.Breakfast);
                result.MealLunch = analysis.FirstPlace.Equals(Category.Lunch) || analysis.SecondPlace.Equals(Category.Lunch);
                result.MealDinner = analysis.FirstPlace.Equals(Category.Dinner) || analysis.SecondPlace.Equals(Category.Dinner);
                result.MealDessert = analysis.FirstPlace.Equals(Category.Dessert) || analysis.SecondPlace.Equals(Category.Dessert);
            }
        }
开发者ID:KaloyanTodorov,项目名称:Teamwork,代码行数:20,代码来源:CategorizationEngine.cs


示例17: GetSections

        public static IngredientSection[] GetSections(Recipe recipe)
        {
            //TODO: This code can probably be done in a LINQ expression, or more efficiently.

            var nullSection = new IngredientSection(null);
            var map = new Dictionary<string, IngredientSection>();

            foreach (var usage in recipe.Ingredients)
            {
                if (string.IsNullOrEmpty(usage.Section))
                {
                    nullSection.Ingredients.Add(usage);
                }
                else
                {
                    var sectionKey = usage.Section.ToLower();

                    IngredientSection sectionList;
                    if (map.TryGetValue(sectionKey, out sectionList))
                    {
                        sectionList.Ingredients.Add(usage);
                    }
                    else
                    {
                        sectionList = new IngredientSection(usage.Section);
                        sectionList.Ingredients.Add(usage);
                        map.Add(sectionKey, sectionList);
                    }
                }
            }

            var result = new List<IngredientSection>();
            if (nullSection.Ingredients.Count > 0)
            {
                result.Add(nullSection);
            }

            result.AddRange(map.Values);

            return result.ToArray();
        }
开发者ID:TeamSullust,项目名称:Teamwork,代码行数:41,代码来源:IngredientSection.cs


示例18: GetPrediction

        public AnalyzerResult GetPrediction(Recipe recipe)
        {
            var winsBr = new Ranking(Category.Breakfast);
             var winsLu = new Ranking(Category.Lunch);
             var winsDi = new Ranking(Category.Dinner);
             var winsDe = new Ranking(Category.Dessert);

             //Setup Tournament
             Compete(recipe, BreakfastIndex, LunchIndex, winsBr, winsLu, winsDi, winsDe);
             Compete(recipe, BreakfastIndex, DinnerIndex, winsBr, winsLu, winsDi, winsDe);
             Compete(recipe, BreakfastIndex, DessertIndex, winsBr, winsLu, winsDi, winsDe);
             Compete(recipe, LunchIndex, DinnerIndex, winsBr, winsLu, winsDi, winsDe);
             Compete(recipe, LunchIndex, DessertIndex, winsBr, winsLu, winsDi, winsDe);
             Compete(recipe, DinnerIndex, DessertIndex, winsBr, winsLu, winsDi, winsDe);

             //Choose winner
             Ranking tag1, tag2;
             var result = GetWinner(winsBr, winsLu, winsDi, winsDe, out tag1, out tag2);

             return result;
        }
开发者ID:Team-Makev-High-Quality-Code,项目名称:TEAM--MAKEB--High-Quality-Code-Team-Project,代码行数:21,代码来源:Analyzer.cs


示例19: CreateRecipe

 public RecipeResult CreateRecipe(Recipe recipe)
 {
     throw new NotImplementedException();
 }
开发者ID:relimited,项目名称:core,代码行数:4,代码来源:MockContext.cs


示例20: RecipeLoader

 public RecipeLoader(IKPCContext context, Recipe recipe)
 {
     this.context = context;
     this.recipesToLoad = new List<Recipe>() { recipe };
 }
开发者ID:Derneuca,项目名称:KitchenPCTeamwork,代码行数:5,代码来源:RecipeLoader.cs



注:本文中的KitchenPC.Recipes.Recipe类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Common.JsonResultData类代码示例发布时间:2022-05-26
下一篇:
C# Tjs2.Variant类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap