Class RecipeFinder
- java.lang.Object
-
- fr.ens.biologie.genomique.aozan.aozan3.recipe.RecipeFinder
-
public class RecipeFinder extends Object
This class define a finder for recipe files.- Since:
- 3.0
- Author:
- Laurent Jourdren
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RecipeFinder.RecipePath
This class define a result of the finder.
-
Constructor Summary
Constructors Constructor Description RecipeFinder(Path directory)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
getRecipeName(Path file)
Load a file and try to get the recipe name inside if it is a recipe file.static Path
getRecipePath(List<RecipeFinder.RecipePath> recipes, String recipeName)
Get the path of a recipe in a list of recipes.List<RecipeFinder.RecipePath>
getRecipes()
Get the recipes existing in the directory.static boolean
isRecipe(List<RecipeFinder.RecipePath> recipes, String recipeName)
Test if a recipe exists in a list of recipes.static boolean
isRecipeUnique(List<RecipeFinder.RecipePath> recipes, String recipeName)
Test if a recipe is unique in a list of recipes.
-
-
-
Constructor Detail
-
RecipeFinder
public RecipeFinder(Path directory) throws Aozan3Exception
Constructor.- Parameters:
directory
- path of the recipe directory- Throws:
Aozan3Exception
- if the path is not an existing directory
-
-
Method Detail
-
getRecipes
public List<RecipeFinder.RecipePath> getRecipes() throws Aozan3Exception
Get the recipes existing in the directory.- Returns:
- a list of the recipe sorted by name
- Throws:
Aozan3Exception
- if an error occurs while searching for recipe files
-
getRecipeName
public static String getRecipeName(Path file)
Load a file and try to get the recipe name inside if it is a recipe file.- Parameters:
file
- the file to load- Returns:
- the name of the recipe in a String or null if the file is not a recipe file
-
isRecipe
public static boolean isRecipe(List<RecipeFinder.RecipePath> recipes, String recipeName)
Test if a recipe exists in a list of recipes.- Parameters:
recipes
- recipe listrecipeName
- name of the recipe- Returns:
- true if the recipe exists
-
isRecipeUnique
public static boolean isRecipeUnique(List<RecipeFinder.RecipePath> recipes, String recipeName)
Test if a recipe is unique in a list of recipes.- Parameters:
recipes
- recipe listrecipeName
- name of the recipe- Returns:
- true if the recipe is unique
-
getRecipePath
public static Path getRecipePath(List<RecipeFinder.RecipePath> recipes, String recipeName)
Get the path of a recipe in a list of recipes.- Parameters:
recipes
- recipe listrecipeName
- name of the recipe- Returns:
- true if the recipe exists
-
-