本文整理汇总了C#中KitchenPC.Recipes.Recipe类的典型用法代码示例。如果您正苦于以下问题:C# Recipe类的具体用法?C# Recipe怎么用?C# Recipe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Recipe类属于KitchenPC.Recipes命名空间,在下文中一共展示了Recipe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例3: RecipeRater
public RecipeRater(IKPCContext context, Recipe recipe, Rating rating)
{
this.context = context;
this.newRatings = new Dictionary<Recipe, Rating>();
this.newRatings.Add(recipe, rating);
}
示例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;
}
示例5: Add
public MenuUpdater Add(Recipe recipe)
{
if (!this.addQueue.Contains(recipe))
{
this.addQueue.Add(recipe);
}
return this;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}