Foodolini.BusinessLogic.Recipe Class Reference

A recipe. More...

Collaboration diagram for Foodolini.BusinessLogic.Recipe:
Collaboration graph

List of all members.

Classes

class  RatingDictionary

Public Member Functions

 Recipe (string title)
 Recipe ()
void ClearIngredients ()
void UpdateCategories ()
void Rate (Person user, double rating)
 The specified person rates the recipe.
void Save ()
 Saves changes to the recipe.
FoodItem Cook (double servingsMultiplier)
FoodItem Cook (double servingsMultiplier, double percentage)
 Cooks the recipe and returns the resulting FoodItem. asume that all the FoodItems is pressent.
void Delete ()
 Deletes the recipe permanently.
override string ToString ()

Static Public Member Functions

static List< RecipeListByCriteria (Criteria criteria)
 Gets a list of recipies filtered by the provided criteria.
static Recipe GetByTitle (string title)

Properties

string Title [get, set]
 The name of the recipe.
internal long Id [get]
IDictionary< Ingredient, double > Ingredients [get, set]
 List of ingredients included in the recipe and amount in grams.
List< string > Directions [get, set]
 Cooking directions for the recipe.
double AverageRating [get]
 The average rating from all votes of the recipe.
IDictionary< Person, double > Ratings [get]
 Gets a dictionary containing persons, who have rated the recipe, including their respective rating.
Difficulty Difficulty [get, set]
 The difficulty of the recipe.
TimeSpan PreparationTime [get, set]
 The amount of time required to cook the recipe.
IList< string > Categories [get, set]
 The associated categories for the recipe.
byte[] Picture [get, set]
 A picture of the recipe.
double Servings [get, set]
 The number of servings produced by the recipe.

Private Member Functions

 Recipe (RecipeRow row)
 Create a recipe from an underlying row, assumed to be unchanged.
void LoadSteps ()
 Load recipe steps to cachedSteps.
void LoadCachedTags ()
 Load cached tags.

Static Private Member Functions

static internal Recipe GetById (long recipeId)
 Loads a single recipe by id.
static List< RecipePrioritiseRecipesAfterRating (List< Recipe > recipes, Criteria criteria)
 Prioritises recipes after their rating. 2.5 stars being middle ground, equalling 0 in priority. Less gains negative influence, more gains positive.
static int GetRatingPriority (double rating)
 Returns the searchPriority value based on the rating value.
static List< RecipePrioritiseRecipesAfterDate (List< Recipe > recipes, Criteria criteria)
 Prioritises recipe after expiration dates. Recipes requiring ingredients which expiration date is approaching are rated higher then others.
static int GetExpirationDatePriority (DateTime expirationDate)
 Returns a searchPriority (int) value based on day count til item expires.
static List< RecipeSortRecipes (List< Recipe > recipes, int index, int length)
 Sorts the recipe in order after searchPriority. Uses the Quicksort algorithm, found in Introduction to Algorithms by: Thomas H. Cormen, Charles E.Leiserson, Ronald L. Rivest and Clifford Stein.
static int Partition (ref List< Recipe > recipes, int start, int length)
 Part of the Quicksort algorithm. Rearranges the subarray passed to it.
static List< RecipePrioritiseRecipes (List< Recipe > recipes, List< string > keywords)
 Prioritise recipes after keywords.
static List< RecipeRemoveIrrelevantRecipes (List< Recipe > recipes, List< string > keywords)
 Removes any recipes that have no reference to the search keyword.
static List< RecipeRowGetRecipeByMeal (Criteria criteria)
 Grabs recipes by meal type, such as Dinner or breakfasts.

Private Attributes

RecipeRow row
 Database-related object.
bool modified = true
 True, if this object have been modified with respect to the database.
IDictionary< Ingredient, double > ingredients = null
List< string > directions
 Steps if loaded.
List< RecipeStepcachedSteps = null
 Lazy cached steps.
RatingDictionary ratings = null
 Lazy loaded ratings dictionary.
List< RecipeTagcachedTags = null
 Lazily loaded list of cached tags.
IList< string > tags = null
 Tags assigned to this Recipe.
Picture picture = null
 Lazy loaded underlying picture row.
bool pictureModified = false
 True, if the underlying lazy loaded picture row have been changed with respect to the database.
int searchPriority = 0

Detailed Description

A recipe.

Definition at line 11 of file Recipe.cs.


Constructor & Destructor Documentation

Foodolini.BusinessLogic.Recipe.Recipe ( RecipeRow  row  )  [private]

Create a recipe from an underlying row, assumed to be unchanged.

Parameters:
row Underlying row, assumed unmodified.

Definition at line 29 of file Recipe.cs.

Foodolini.BusinessLogic.Recipe.Recipe ( string  title  ) 

Definition at line 35 of file Recipe.cs.

Foodolini.BusinessLogic.Recipe.Recipe (  ) 

Definition at line 42 of file Recipe.cs.


Member Function Documentation

void Foodolini.BusinessLogic.Recipe.ClearIngredients (  ) 

Definition at line 89 of file Recipe.cs.

FoodItem Foodolini.BusinessLogic.Recipe.Cook ( double  servingsMultiplier,
double  percentage 
)

Cooks the recipe and returns the resulting FoodItem. asume that all the FoodItems is pressent.

Parameters:
servingsMultiplier The number of servings to prepare
Returns:
FoodItem

Definition at line 457 of file Recipe.cs.

FoodItem Foodolini.BusinessLogic.Recipe.Cook ( double  servingsMultiplier  ) 

Definition at line 446 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.Delete (  ) 

Deletes the recipe permanently.

Definition at line 544 of file Recipe.cs.

static internal Recipe Foodolini.BusinessLogic.Recipe.GetById ( long  recipeId  )  [static, private]

Loads a single recipe by id.

Parameters:
recipeId 
Returns:

Definition at line 441 of file Recipe.cs.

static Recipe Foodolini.BusinessLogic.Recipe.GetByTitle ( string  title  )  [static]

Loads a single Recipe by Title.

Parameters:
description 
Returns:

Definition at line 955 of file Recipe.cs.

static int Foodolini.BusinessLogic.Recipe.GetExpirationDatePriority ( DateTime  expirationDate  )  [static, private]

Returns a searchPriority (int) value based on day count til item expires.

Definition at line 715 of file Recipe.cs.

static int Foodolini.BusinessLogic.Recipe.GetRatingPriority ( double  rating  )  [static, private]

Returns the searchPriority value based on the rating value.

Definition at line 647 of file Recipe.cs.

static List<RecipeRow> Foodolini.BusinessLogic.Recipe.GetRecipeByMeal ( Criteria  criteria  )  [static, private]

Grabs recipes by meal type, such as Dinner or breakfasts.

Definition at line 917 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.ListByCriteria ( Criteria  criteria  )  [static]

Gets a list of recipies filtered by the provided criteria.

Parameters:
criteria Search terms, see Criteria struct
Returns:
List of recipies

Definition at line 592 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.LoadCachedTags (  )  [private]

Load cached tags.

Definition at line 235 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.LoadSteps (  )  [private]

Load recipe steps to cachedSteps.

Definition at line 120 of file Recipe.cs.

static int Foodolini.BusinessLogic.Recipe.Partition ( ref List< Recipe recipes,
int  start,
int  length 
) [static, private]

Part of the Quicksort algorithm. Rearranges the subarray passed to it.

Definition at line 753 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.PrioritiseRecipes ( List< Recipe recipes,
List< string >  keywords 
) [static, private]

Prioritise recipes after keywords.

Definition at line 776 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.PrioritiseRecipesAfterDate ( List< Recipe recipes,
Criteria  criteria 
) [static, private]

Prioritises recipe after expiration dates. Recipes requiring ingredients which expiration date is approaching are rated higher then others.

Definition at line 693 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.PrioritiseRecipesAfterRating ( List< Recipe recipes,
Criteria  criteria 
) [static, private]

Prioritises recipes after their rating. 2.5 stars being middle ground, equalling 0 in priority. Less gains negative influence, more gains positive.

Definition at line 631 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.Rate ( Person  user,
double  rating 
)

The specified person rates the recipe.

Parameters:
user The rater
rating The rating

Definition at line 184 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.RemoveIrrelevantRecipes ( List< Recipe recipes,
List< string >  keywords 
) [static, private]

Removes any recipes that have no reference to the search keyword.

Definition at line 832 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.Save (  ) 

Saves changes to the recipe.

Definition at line 328 of file Recipe.cs.

static List<Recipe> Foodolini.BusinessLogic.Recipe.SortRecipes ( List< Recipe recipes,
int  index,
int  length 
) [static, private]

Sorts the recipe in order after searchPriority. Uses the Quicksort algorithm, found in Introduction to Algorithms by: Thomas H. Cormen, Charles E.Leiserson, Ronald L. Rivest and Clifford Stein.

Definition at line 738 of file Recipe.cs.

override string Foodolini.BusinessLogic.Recipe.ToString (  ) 

Definition at line 963 of file Recipe.cs.

void Foodolini.BusinessLogic.Recipe.UpdateCategories (  ) 

Definition at line 96 of file Recipe.cs.


Member Data Documentation

Lazy cached steps.

Not loaded if user imidiately overwrites all directions, but setting Directions.

Definition at line 115 of file Recipe.cs.

Lazily loaded list of cached tags.

Definition at line 230 of file Recipe.cs.

Steps if loaded.

Definition at line 109 of file Recipe.cs.

IDictionary<Ingredient, double> Foodolini.BusinessLogic.Recipe.ingredients = null [private]

Definition at line 63 of file Recipe.cs.

True, if this object have been modified with respect to the database.

Definition at line 21 of file Recipe.cs.

Lazy loaded underlying picture row.

Definition at line 276 of file Recipe.cs.

True, if the underlying lazy loaded picture row have been changed with respect to the database.

Definition at line 281 of file Recipe.cs.

Lazy loaded ratings dictionary.

Definition at line 163 of file Recipe.cs.

Database-related object.

Definition at line 16 of file Recipe.cs.

Definition at line 585 of file Recipe.cs.

IList<string> Foodolini.BusinessLogic.Recipe.tags = null [private]

Tags assigned to this Recipe.

Lazily loaded or assigned

Definition at line 249 of file Recipe.cs.


Property Documentation

double Foodolini.BusinessLogic.Recipe.AverageRating [get]

The average rating from all votes of the recipe.

Definition at line 156 of file Recipe.cs.

IList<string> Foodolini.BusinessLogic.Recipe.Categories [get, set]

The associated categories for the recipe.

Definition at line 255 of file Recipe.cs.

Difficulty Foodolini.BusinessLogic.Recipe.Difficulty [get, set]

The difficulty of the recipe.

Definition at line 205 of file Recipe.cs.

List<string> Foodolini.BusinessLogic.Recipe.Directions [get, set]

Cooking directions for the recipe.

Definition at line 134 of file Recipe.cs.

internal long Foodolini.BusinessLogic.Recipe.Id [get, private]

Definition at line 61 of file Recipe.cs.

IDictionary<Ingredient, double> Foodolini.BusinessLogic.Recipe.Ingredients [get, set]

List of ingredients included in the recipe and amount in grams.

Definition at line 69 of file Recipe.cs.

byte [] Foodolini.BusinessLogic.Recipe.Picture [get, set]

A picture of the recipe.

You cannot reuse this memory, if you wish to alter the image you must do a set operation!

Definition at line 288 of file Recipe.cs.

TimeSpan Foodolini.BusinessLogic.Recipe.PreparationTime [get, set]

The amount of time required to cook the recipe.

Definition at line 218 of file Recipe.cs.

IDictionary<Person, double> Foodolini.BusinessLogic.Recipe.Ratings [get]

Gets a dictionary containing persons, who have rated the recipe, including their respective rating.

Definition at line 170 of file Recipe.cs.

double Foodolini.BusinessLogic.Recipe.Servings [get, set]

The number of servings produced by the recipe.

Definition at line 316 of file Recipe.cs.

string Foodolini.BusinessLogic.Recipe.Title [get, set]

The name of the recipe.

Definition at line 52 of file Recipe.cs.


The documentation for this class was generated from the following file:

Foodolini 1.0.0 Documentation, generated with DoxyGen.