Java project
project_additions/CuisineType.java
project_additions/CuisineType.java
public
enum
CuisineType
{
ITALIAN
,
MEXICAN
,
THAI
,
AMERICAN
,
JAPANESE
,
CHINESE
,
FRENCH
,
VIETNAMESE
,
KOREAN
,
NONE
}
project_additions/Design_Doc.docx
image4.emf
oleObject4.bin
1
Display Constructor: Create panels Create textBoxes
image5.emf
oleObject5.bin
1
image1.emf
oleObject1.bin
1
image2.emf
oleObject2.bin
1
image3.emf
oleObject3.bin
1
project_additions/DietType.java
project_additions/DietType.java
public
enum
DietType
{
VEGETARIAN
,
VEGAN
,
NONE
}
project_additions/Display.java
project_additions/Display.java
import
java
.
awt
.
BorderLayout
;
import
java
.
awt
.
GridBagLayout
;
import
java
.
awt
.
GridLayout
;
import
java
.
io
.
File
;
import
javax
.
swing
.
Box
;
import
javax
.
swing
.
DefaultListModel
;
import
javax
.
swing
.
DefaultListSelectionModel
;
import
javax
.
swing
.
JButton
;
import
javax
.
swing
.
JComboBox
;
import
javax
.
swing
.
JFileChooser
;
import
javax
.
swing
.
JFrame
;
import
javax
.
swing
.
JLabel
;
import
javax
.
swing
.
JList
;
import
static
javax
.
swing
.
JList
.
VERTICAL
;
import
javax
.
swing
.
JMenu
;
import
javax
.
swing
.
JMenuBar
;
import
javax
.
swing
.
JMenuItem
;
import
javax
.
swing
.
JOptionPane
;
import
javax
.
swing
.
JPanel
;
import
javax
.
swing
.
JScrollPane
;
import
javax
.
swing
.
JSplitPane
;
import
javax
.
swing
.
JTabbedPane
;
import
javax
.
swing
.
JTextArea
;
import
javax
.
swing
.
JTextField
;
// Date: July 6, 2017
// Authors:
// Purpose: Create a recipe manager
/**
*
*/
public
class
Display
extends
JFrame
{
//global variables
static
final
long
serialVerisionUID
=
123L
;
JTextArea
jta
=
new
JTextArea
();
static
DefaultListModel
listModel
,
pantryListModel
,
shoppingListModel
;
JMenuBar
menuBar
;
JMenu
menu
,
submenu
;
JMenuItem
menuItem
;
JTextField
jtf
=
new
JTextField
(
20
);
JButton
searchButton
=
new
JButton
(
"Search"
);
JComboBox
<
String
>
jcb
=
new
JComboBox
<
String
>
();
JList
list
,
pantryList
,
shoppingList
;
File
photoFile
=
null
;
final
JFileChooser
fc
=
new
JFileChooser
();
JTabbedPane
tp
=
new
JTabbedPane
();
public
static
void
main
(
String
[]
args
){
Display
gui
=
new
Display
();
}
// end main method
//constructor
public
Display
()
{
//setting basic jframe functions
setTitle
(
"Recipe Manager"
);
setSize
(
900
,
600
);
setDefaultCloseOperation
(
JFrame
.
EXIT_ON_CLOSE
);
setVisible
(
true
);
setLocationRelativeTo
(
null
);
//setting text area for recipe
jta
.
setEditable
(
false
);
JScrollPane
jsp
=
new
JScrollPane
(
jta
);
//setting recipe list pane
listModel
=
new
DefaultListModel
();
list
=
new
JList
(
listModel
);
list
.
setLayoutOrientation
(
VERTICAL
);
list
.
setSelectionMode
(
DefaultListSelectionModel
.
SINGLE_SELECTION
);
JScrollPane
listpane
=
new
JScrollPane
(
list
);
list
.
getSelectionModel
().
addListSelectionListener
(
e
->
listContents
());
//setting pantry list pane
pantryListModel
=
new
DefaultListModel
();
pantryList
=
new
JList
(
pantryListModel
);
pantryList
.
setLayoutOrientation
(
VERTICAL
);
pantryList
.
setSelectionMode
(
DefaultListSelectionModel
.
SINGLE_SELECTION
);
JScrollPane
pantryListPane
=
new
JScrollPane
(
pantryList
);
//setting shopping list pane
shoppingListModel
=
new
DefaultListModel
();
shoppingList
=
new
JList
(
pantryListModel
);
shoppingList
.
setLayoutOrientation
(
VERTICAL
);
shoppingList
.
setSelectionMode
(
DefaultListSelectionModel
.
SINGLE_SELECTION
);
JScrollPane
shoppingListPane
=
new
JScrollPane
(
shoppingList
);
//setting menu
SetMenuBar
();
add
(
menuBar
,
BorderLayout
.
PAGE_START
);
//setting the split panes
JSplitPane
splitpane
=
new
JSplitPane
(
JSplitPane
.
HORIZONTAL_SPLIT
);
splitpane
.
setRightComponent
(
jsp
);
splitpane
.
setLeftComponent
(
listpane
);
// setting tabbed panes
tp
.
add
(
"recipes"
,
splitpane
);
tp
.
add
(
"pantry"
,
pantryListPane
);
tp
.
add
(
"shopping"
,
shoppingListPane
);
add
(
tp
);
// add(splitpane,BorderLayout.CENTER);
validate
();
// validates all components
}
// end display constructor
//class for setting menu bar
private
void
SetMenuBar
(){
menuBar
=
new
JMenuBar
();
//Recipe Menu
menu
=
new
JMenu
(
"Recipe"
);
menuBar
.
add
(
menu
);
menuItem
=
new
JMenuItem
(
"add recipe"
);
menuItem
.
addActionListener
(
e
->
recipeForm
()
);
menu
.
add
(
menuItem
);
menuItem
=
new
JMenuItem
(
"edit recipe"
);
menuItem
.
addActionListener
(
e
->
editForm
());
menu
.
add
(
menuItem
);
menuItem
=
new
JMenuItem
(
"remove selected recipe"
);
menuItem
.
addActionListener
(
e
->
editForm
());
menu
.
add
(
menuItem
);
//Pantry Menu
//Pantry Menu
menu
=
new
JMenu
(
"Pantry"
);
menuBar
.
add
(
menu
);
menuItem
=
new
JMenuItem
(
"Add to Pantry"
);
menuItem
.
addActionListener
(
e
->
Input
.
addToPantry
());
menu
.
add
(
menuItem
);
menuItem
=
new
JMenuItem
(
"Remove from Pantry"
);
menu
.
add
(
menuItem
);
//Shopping List Menu
menu
=
new
JMenu
(
"Shopping"
);
menuBar
.
add
(
menu
);
menuItem
=
new
JMenuItem
(
"Add selected recipe to list"
);
menu
.
add
(
menuItem
);
//Export Menu
menu
=
new
JMenu
(
"Export"
);
menuBar
.
add
(
menu
);
menuItem
=
new
JMenuItem
(
"Print"
);
menu
.
add
(
menuItem
);
menuItem
=
new
JMenuItem
(
"Social Media"
);
menu
.
add
(
menuItem
);
// adding to the right
menuBar
.
add
(
Box
.
createHorizontalGlue
());
menuBar
.
add
(
searchBar
());
}
// end setmenubar method
private
JPanel
searchBar
(){
//still working on this
JPanel
jp
=
new
JPanel
();
jcb
.
addItem
(
"Name"
);
jcb
.
addItem
(
"Type"
);
jcb
.
addItem
(
"Ingredients"
);
jp
.
add
(
jtf
);
jp
.
add
(
jcb
);
jp
.
add
(
searchButton
);
searchButton
.
addActionListener
(
e
->
Input
.
searchRecipe
());
return
jp
;
}
// end searchBar method
protected
void
recipeForm
(){
// method for adding recipe
JFrame
addFrame
=
new
JFrame
(
"Add Recipe"
);
JTextField
recipeName
=
new
JTextField
(
20
);
JTextField
ingredients
=
new
JTextField
();
JTextArea
instructions
=
new
JTextArea
();
JScrollPane
scrollpane
=
new
JScrollPane
(
instructions
);
JButton
addPicture
=
new
JButton
(
"Add Picture"
);
addFrame
.
setLocationRelativeTo
(
null
);
JPanel
form
=
new
JPanel
(
new
GridLayout
(
0
,
1
));
form
.
add
(
new
JLabel
(
"Recipe Name"
));
form
.
add
(
recipeName
);
form
.
add
(
new
JLabel
(
"Ingredients delimited by ';'"
));
form
.
add
(
ingredients
);
form
.
add
(
new
JLabel
(
"Instructions"
));
form
.
add
(
scrollpane
);
form
.
add
(
addPicture
);
addPicture
.
addActionListener
(
e
->
addPhoto
(
addFrame
));
// JPanel Button Panel = new JPanel();
JPanel
buttons
=
new
JPanel
();
JButton
submit
=
new
JButton
(
"Add"
);
submit
.
addActionListener
(
e
->
Input
.
addRecipe
(
recipeName
.
getText
(),
ingredients
.
getText
(),
instructions
.
getText
(),
addFrame
)
);
// submit.addActionListener(e -> );
JButton
cancel
=
new
JButton
(
"Cancel"
);
cancel
.
addActionListener
(
e
->
addFrame
.
dispose
());
buttons
.
add
(
submit
);
buttons
.
add
(
cancel
);
form
.
add
(
buttons
);
addFrame
.
add
(
form
);
addFrame
.
pack
();
addFrame
.
setSize
(
500
,
500
);
addFrame
.
setVisible
(
true
);
}
//end method addRecipe
private
void
addPhoto
(
JFrame
form
){
int
returnVal
=
fc
.
showOpenDialog
(
form
);
if
(
returnVal
==
JFileChooser
.
APPROVE_OPTION
)
{
photoFile
=
fc
.
getSelectedFile
();
}
}
protected
void
editForm
(){
//Object selected = listModel.getElementAt(list.getSelectedIndex());
JFrame
editFrame
=
new
JFrame
(
"Edit Recipe"
);
JTextField
recipeName
=
new
JTextField
(
20
);
JTextField
ingredients
=
new
JTextField
();
JTextArea
instructions
=
new
JTextArea
();
JScrollPane
scrollpane
=
new
JScrollPane
(
instructions
);
JButton
addPicture
=
new
JButton
(
"Add Picture"
);
editFrame
.
setLocationRelativeTo
(
null
);
JPanel
form
=
new
JPanel
(
new
GridLayout
(
0
,
1
));
form
.
add
(
new
JLabel
(
"Recipe Name"
));
form
.
add
(
recipeName
);
form
.
add
(
new
JLabel
(
"Ingredients delimited by ';'"
));
form
.
add
(
ingredients
);
form
.
add
(
new
JLabel
(
"Instructions"
));
form
.
add
(
scrollpane
);
// JPanel Button Panel = new JPanel();
form
.
add
(
addPicture
);
addPicture
.
addActionListener
(
e
->
addPhoto
(
editFrame
));
JPanel
buttons
=
new
JPanel
();
JButton
submit
=
new
JButton
(
"Add"
);
submit
.
addActionListener
(
e
->
Input
.
addRecipe
(
recipeName
.
getText
(),
ingredients
.
getText
(),
instructions
.
getText
(),
editFrame
)
);
// submit.addActionListener(e -> );
JButton
cancel
=
new
JButton
(
"Cancel"
);
cancel
.
addActionListener
(
e
->
editFrame
.
dispose
());
buttons
.
add
(
submit
);
buttons
.
add
(
cancel
);
form
.
add
(
buttons
);
editFrame
.
add
(
form
);
editFrame
.
pack
();
editFrame
.
setSize
(
500
,
500
);
editFrame
.
setVisible
(
true
);
}
// end editForm method
protected
void
removeRecipe
(){
}
protected
void
listContents
(){
//lists the contents of the recipe/pantry list/ shopping list
}
protected
void
addToShoppingList
(){
}
// defines the actions for the components
static
class
Input
{
protected
static
void
searchRecipe
(){
// method for searching Recipe
/*
Here a method should be added for searching the recipe... soemthing like
Recipe = search(jcb.getSelected.toString(), jtf.getText())
^ that method will return a recipe, so I can add the result later
*/
//return recipe
//set textbox
}
// end method searchRecipe
protected
static
void
addRecipe
(
String
name
,
String
ingredients
,
String
instruction
,
JFrame
addFrame
){
//create a recipe object from this
//photoFile is global
//add object to the list model... be sure to have a toString method with the recipes name
listModel
.
addElement
(
"test"
);
addFrame
.
dispose
();
}
// end addRecipe method
protected
static
void
editRecipe
(){
}
//end editRecipe form
protected
static
void
removeRecipe
(){
//removing the selected recope from the list
}
protected
static
void
addToPantry
(){
String
ingredients
=
JOptionPane
.
showInputDialog
(
"Add ingredients delimited by ';'"
);
//takes a string of ingredients and then addes each as an ingredient
}
}
// end class input
}
// end class Display
project_additions/Ingredient.java
project_additions/Ingredient.java
import
java
.
awt
.
image
.
BufferedImage
;
/**
* Revisions
*
* | Revision # | Date | Description | Name |
* +------------+-------+-----------------------+---------------+
* | 1 | 7/2 | First Draft | Chris |
* +------------+-------+-----------------------+---------------+
* | 1 | 7/9 | Added toString() | Josh |
* +------------+-------+-----------------------+---------------+
*
*/
public
class
Ingredient
{
public
String
ingredientName
;
public
BufferedImage
photo
;
public
String
description
;
public
Ingredient
(
String
name
,
String
desc
)
{
ingredientName
=
name
;
photo
=
null
;
description
=
desc
;
}
@
Override
public
String
toString
()
{
return
"Ingredient [ingredientName="
+
ingredientName
+
", photo="
+
photo
+
", description="
+
description
+
"]"
;
}
}
project_additions/MealType.java
project_additions/MealType.java
public
enum
MealType
{
BREAKFAST
,
LUNCH
,
DINNER
,
SNACK
,
BRUNCH
,
DESSERT
,
NONE
}
project_additions/MeasuredIngredient.java
project_additions/MeasuredIngredient.java
public
class
MeasuredIngredient
extends
Ingredient
{
public
MeasurementType
measurementType
;
public
float
measurementAmount
;
public
String
specialInstructions
;
public
MeasuredIngredient
(
Ingredient
ingredient
,
MeasurementType
type
,
float
amount
,
String
instructions
)
{
super
(
ingredient
.
ingredientName
,
ingredient
.
description
);
measurementType
=
type
;
measurementAmount
=
amount
;
specialInstructions
=
instructions
;
}
}
project_additions/MeasurementType.java
project_additions/MeasurementType.java
import
java
.
util
.
EnumSet
;
public
enum
MeasurementType
{
CUP
,
TEASPOON
,
TABLESPOON
,
FLUID_OUNCE
,
MILLILITER
,
LITER
,
DECILITER
,
POUND
,
OUNCE
,
MILIGRAM
,
GRAM
,
KILOGRAM
;
public
static
EnumSet
<
MeasurementType
>
volume
=
EnumSet
.
of
(
CUP
,
TEASPOON
,
TABLESPOON
,
FLUID_OUNCE
,
MILLILITER
,
LITER
,
DECILITER
);
public
static
EnumSet
<
MeasurementType
>
mass
=
EnumSet
.
of
(
POUND
,
OUNCE
,
MILIGRAM
,
GRAM
,
KILOGRAM
);
}
project_additions/Pantry.java
project_additions/Pantry.java
import
java
.
util
.
ArrayList
;
/**
* Revisions
*
* | Revision # | Date | Description | Name |
* +------------+-------+-----------------------+---------------+
* | 1 | 7/9 | First Draft | Josh |
* +------------+-------+-----------------------+---------------+
*
*/
public
class
Pantry
{
private
ArrayList
<
Ingredient
>
ingredients
;
public
Pantry
(
Ingredient
ingredient
)
{
ingredients
=
new
ArrayList
<>
();
ingredients
.
add
(
ingredient
);
}
public
Pantry
()
{
}
public
void
addIngredient
(
Ingredient
ingredient
)
{
if
(
ingredients
.
contains
(
ingredient
))
{
System
.
out
.
println
(
"Don't Add!"
);
}
else
{
ingredients
.
add
(
ingredient
);
}
}
public
String
removeIngredient
(
Ingredient
ingredient
)
{
if
(
ingredients
.
contains
(
ingredient
))
{
ingredients
.
remove
(
ingredient
);
return
"Removed"
;
}
return
"Not found"
;
}
@
Override
public
String
toString
()
{
return
"Pantry [ingredients="
+
getIngredients
()
+
"]"
;
}
public
String
getIngredients
()
{
return
ingredients
.
toString
();
}
public
void
setIngredients
(
ArrayList
<
Ingredient
>
ingredients
)
{
this
.
ingredients
=
ingredients
;
}
}
project_additions/project_requirements.docx
|
Requirement # |
Description |
Task |
|
1 |
The application shall allow the user to manually input recipes |
· Ingredient · Fields · constructor(s) · MeasuredIngredient · Subclass of Ingredient that represents a measured quantity of a unique ingredient in the pantry · Extra fields for amount, measurementType, and specialInstructions · constructor(s) · Recipe · Fields · Constructor(s) · Display · Prompt user for new recipe fields, new ingredient fields, save recipe and prompt for a new recipe · Input |
|
2 |
The application shall allow the user to browse recipes |
· RecipeBook · Display · Browse RecipeBook and view Recipe |
|
3 |
The application shall allow the user to edit recipes |
· RecipeBook · removeRecipe() · addRecipe() |
|
4 |
The application shall allow the user to convert ingredient measurements to metric |
· Measurement · Constructor(s) |
|
5 |
The application shall allow the user to import pictures to recipes
|
· Recipe · importPhoto() · Display · Display and format picture for browsing, viewing, editing recipes |
|
6 |
The application shall allow the user to export “printer friendly” recipes |
· FacebookIntegration · postRecipe(Recipe recipe) · Display · Display and Format recipe |
|
7 |
The application shall allow the user to share printer friendly recipes to social media |
· FacebookIntegration · postRecipe(Recipe recipe) · facebookClient.publish() · Display · Displays confirmation |
|
8 |
The application shall allow the user to create a shopping list from recipes |
· ShoppingList · List of recipe items · Display · Displays recipe items needed |
|
9 |
The application shall allow the user to add or remove ingredients from their “pantry” |
· Pantry · addIngredient() · removeIngredient() · Display · Display Ingredients |
|
10 |
The application shall take into account the “pantry” inventory when generating shopping lists from recipes |
· ShoppingList · Recipe chosen from list · Pantry · Ingredients available for recipe · Display · Display items needed |
|
11 |
The application shall allow the user to filter recipes in the following manners: · By ingredient · By diet · By cuisine · By meal |
· RecipeBook · recipeMethod(searchType) · Display · Display search results |
project_additions/pseudo-code.docx
a. Input Subsystem:
(a subclass of the Display Class)
Class Input{
Takes input from the display and then sorts;
}//end class Input
b. Recipe Subsystem:
Class Recipe{
String name;
ArrayList[Ingredient] ingredientList;
ArrayList ingredientMeasurements
Enum dietType
Enum cuisineType
Enum mealType
ArrayList[String] instructions;
//Recipe Photo
Constructor(){
}
UpdateShoppingList(){
//update the shopping list with ingredients from this recipe that aren’t in the pantry
}
ImportPhoto(String filepath){
//create photo object and associate it with this recipe
}
toString(){
//format recipe
}
addIngredient(Ingredient ingredient, Measurement measurement){
ingredientList.add(ingredient)
ingredientMeasurements.add(measurement)
}
removeIngredient(int ingredientListIndex){
ingredientList.remove(ingredientListIndex)
ingredientMeasurements.remove(ingredientListIndex)
}
setDietType(Enum type){
dietType = type
}
setCuisineType(Enum type){
cuisineType = type
}
setMealType(Enum type){
mealType = type
}
addInstruction(String instruction){
instructions.add(instruction);
}
}//end class Recipe
c. Ingredient Subsystem:
Class Ingredient{
String name;
//Ingredient photo
String description
importPhoto(String filepath){
//create photo object and associate it with this ingredient
}
setDescription(String desc){
description = desc
}
}//end class Ingredient
d. Display Subsystem:
Class Display{
constructor(){
Create panels
Create text boxes;
}
Tabs for recipe book, pantry, and shopping list
Actionlisteners for search button
Radio buttons, fields, etc. for filtering
Menu buttons for adding recipe, ingredient
}//end class Display
e. Share to Social Media Subsystem:
Class FacebookIntegration{
FacebookClient facebookClient //object to access facebook data
postRecipe(Recipe recipe){
facebookClient.publish(); //publish given recipe’s toString and photo
}
}//end class FacebookIntegration
f. Shopping List Subsystem:
Class ShoppingList{
ArrayList Ingredients;
Constructor(){
Initialize objects
}
addList(recipe){
Adds a recipe’s ingredients to the list, unless they are already in the pantry;
}
removeList(ingredient or index){
Removes an ingredient from the list;
}
toString(){
Returns a string version of the recipes ingredients;
}
}//end class ShoppingList
g. Pantry Subsystem:
Class Pantry{
ArrayList Ingredients
Constructor(ingredient){
Initialize objects;
}// end constructor
addIngredient Method(ingredient){
If the ingredient is already in the list, then send popup saying that there is already and ingredient;
Else add the ingredient to the pantry
}
removeIngredient Method(ingredient){
Iterate through Ingredients array list;
Remove ingredient;
Send confirmation dialogue to user;
}
toString(){
Returns the whole list of ingredients in string form;
}
}// end Pantry Class
h. Recipe Book Subsystem:
Class RecipeBook{
ArrayList Recipes;
ArrayList SearchResults
Constructor(){
Initialize object;s
}
Findrecipe method(searchtype){
If by name… then search by name;
If by cusinetype… then by cusinetype;
If by ingredients.. Then by ingredients;
Adds to an arrayList of the search results
And then returns the arraylist search results
}
addRecipe(){
Creates a recipe;
Adds to recipe list;
}
removeRecipe(){
Removes recipe from list;
}
}
project_additions/Recipe.java
project_additions/Recipe.java
import
java
.
util
.
ArrayList
;
/**
* Revisions
*
* | Revision # | Date | Description | Name |
* +------------+-------+-----------------------+---------------+
* | 1 | 7/2 | First Draft | Chris |
* +------------+-------+-----------------------+---------------+
* +------------+-------+-----------------------+---------------+
* | 2 | 7/9 | Added getters/setters | Josh |
* +------------+-------+-----------------------+---------------+
*
*/
public
class
Recipe
{
private
String
recipeName
;
private
ArrayList
<
MeasuredIngredient
>
ingredientList
;
private
ArrayList
<
Ingredient
>
ingredients
;
private
DietType
dietType
;
private
CuisineType
cuisineType
;
private
MealType
mealType
;
private
ArrayList
<
String
>
instructions
;
public
Recipe
(
String
name
){
setRecipeName
(
name
);
ingredientList
=
new
ArrayList
<>
();
setDietType
(
DietType
.
NONE
);
setCuisineType
(
CuisineType
.
NONE
);
setMealType
(
MealType
.
NONE
);
instructions
=
new
ArrayList
<>
();
ingredients
=
new
ArrayList
<>
();
}
public
Recipe
()
{
}
public
void
addIngredient
(
Ingredient
ingredient
,
MeasuredIngredient
measurement
){
ingredients
.
add
(
ingredient
);
ingredientList
.
add
(
measurement
);
}
public
void
removeIngredient
(
int
ingredientListIndex
){
ingredientList
.
remove
(
ingredientListIndex
);
ingredientList
.
remove
(
ingredientListIndex
);
}
public
void
addInstruction
(
String
instruction
){
instructions
.
add
(
instruction
);
}
public
String
getRecipeName
()
{
return
recipeName
;
}
public
void
setRecipeName
(
String
recipeName
)
{
this
.
recipeName
=
recipeName
;
}
public
DietType
getDietType
()
{
return
dietType
;
}
public
void
setDietType
(
DietType
dietType
)
{
this
.
dietType
=
dietType
;
}
public
CuisineType
getCuisineType
()
{
return
cuisineType
;
}
public
void
setCuisineType
(
CuisineType
cuisineType
)
{
this
.
cuisineType
=
cuisineType
;
}
public
MealType
getMealType
()
{
return
mealType
;
}
public
void
setMealType
(
MealType
mealType
)
{
this
.
mealType
=
mealType
;
}
}
project_additions/RecipeBook.java
project_additions/RecipeBook.java
import
java
.
util
.
ArrayList
;
/**
*
*/
public
class
RecipeBook
{
private
ArrayList
<
String
>
recipes
;
private
ArrayList
<
String
>
searchResults
;
public
RecipeBook
()
{
recipes
=
new
ArrayList
<
String
>
();
searchResults
=
new
ArrayList
<
String
>
();
}
// private String findRecipe(String searchType) {
// String result ="";
// ArrayList<String> searchResults = new ArrayList<String>();
// ArrayList<String> recipes = new ArrayList<String>();
// if (searchType.equals("name")) {
/// will be using comparator to sort by name, cuisine etc...
// }
// searchResults.add(new recipes());
//}
public
void
addRecipe
(
String
name
,
String
instruction
,
String
ingredients
,
String
cusine
){
//Adds to recipe list;
ArrayList
<
String
>
recipes
=
new
ArrayList
<
String
>
();
//removals will be selected via GUI
recipes
.
add
(
name
);
recipes
.
add
(
instruction
);
recipes
.
add
(
ingredients
);
recipes
.
add
(
cusine
);
}
public
void
removeRecipe
(
String
name
,
String
instruction
,
String
ingredients
,
String
cusine
){
//Removes recipe from list;
ArrayList
<
String
>
recipes
=
new
ArrayList
<
String
>
();
//removals will be selected via GUI
recipes
.
remove
(
name
);
recipes
.
remove
(
instruction
);
recipes
.
remove
(
ingredients
);
recipes
.
remove
(
cusine
);
}
public
String
[]
getIngsInRecipe
(
String
recipe
)
{
// TODO Auto-generated method stub
return
null
;
}
public
Object
getInstr
(
String
recipe
)
{
// TODO Auto-generated method stub
return
null
;
}
}
/*
This is the psuedo-code from the Design document for the RecipeBook Class
ArrayList Recipes;
ArrayList SearchResults
Constructor(){
Initialize object;s
}
Findrecipe method(searchtype){
If by name… then search by name;
If by cusinetype… then by cusinetype;
If by ingredients.. Then by ingredients;
Adds to an arrayList of the search results
And then returns the arraylist search results
}
addRecipe(){
Creates a recipe;
Adds to recipe list;
}
removeRecipe(){
Removes recipe from list;
}
}
*/
project_additions/requirements_Document.txt
The focus is on requirement number 2, 3, and 11
project_additions/tasks.txt
1.) The application shall allow the user to browse recipes: RecipeBook -> list all Display class ->Browse RecipeBook and view Recipe ==== 2.) The application shall allow the user to edit recipes: RecipeBook class->removeRecipe() RecipeBook class-> addRecipe() ==== 3.) The application shall allow the user to filter recipes in the following manners: • By ingredient (enum FROM Ingredient class) • By diet (enum from DietType class)-(VEGETARIAN, VEGAN) • By cuisine (enum from CuisineType class) (ITALIAN, MEXICAN, THAI, AMERICAN, JAPANESE, CHINESE, FRENCH, VIETNAMESE, KOREAN) • By meal ((enum from MealType class)) (BREAKFAST, LUNCH, DINNER, SNACK, BRUNCH, DESSERT, NONE) RecipeBook class -> recipeMethod(searchType) Display class -> Display search results ==== the recipebook class should really be just adding to a list creating a recipe and adding to the list deleting a recipe from a list and using a search target to search a list using loops to just iterate through and find a recipe by a certain tag such as name