Class DishFactory

java.lang.Object
com.csse3200.game.entities.factories.DishFactory

public class DishFactory extends Object
Factory to create a cooking entity with predefined components. Predefined recipe properties are loaded from a config stored as a json file and should have the properties stores in 'CookingConfig'.
  • Constructor Details

    • DishFactory

      public DishFactory()
      Constructor for the DishFactory class, no parameters required.
  • Method Details

    • getPossibleRecipes

      public static List<String> getPossibleRecipes(List<String> ingredients)
      Get the list of possible recipes for associated ingredients
      Parameters:
      ingredients - - needed to make the dish (specify in the recipe.json)
      Returns:
      - list of recipes that contain associated ingredients
    • getDefinitiveRecipe

      public static Optional<String> getDefinitiveRecipe(List<String> ingredients)
      Gets a recipe if and only if it matches exactly the list of ingredients
      Parameters:
      ingredients - - needed to make the dish (specify in the recipe.json
      Returns:
      - name of recipe that contain associated ingredients
    • getSingleStationRecipe

      public static SingleStationRecipeConfig getSingleStationRecipe(String recipeName)
      Returns the single station recipe config for the given recipe name.
      Parameters:
      recipeName - - the recipe config searched for.
      Returns:
      - the SingleStationRecipeConfig for the given recipe name.
    • getMultiStationRecipe

      public static MultiStationRecipeConfig getMultiStationRecipe(String recipeName)
      Returns the multi station recipe config for the given recipe name.
      Parameters:
      recipeName - - the recipe config searched for.
      Returns:
      - the MultiStationRecipeConfig for the given recipe name.
    • recipeExists

      public static boolean recipeExists(String recipeName)
      Checks if the provided recipe name is a valid recipe as defined in the recipe.json.
      Parameters:
      recipeName - - the recipe searched for.
      Returns:
      - true if the recipe is valid, false otherwise.
    • getAllRecipes

      public Map<String,SingleStationRecipeConfig> getAllRecipes()
      Get all the recipes from the dish factory
      Returns:
      the recipes from the dish factory
    • getRealRecipe

      public Optional<String> getRealRecipe(List<String> ingredients)
      get the recipe from a list of ingredients
      Parameters:
      ingredients - : The list of ingredients in the dish
      Returns:
      The recipe made from the ingredients