Skip to content

Commit 15356ce

Browse files
authored
Merge pull request #74 from AY1920S2-CS2103T-W12-4/main-zain
Refactor: rename files under src\main\java\seedu\address\model:
2 parents 12e46c2 + 592c6bb commit 15356ce

File tree

78 files changed

+996
-995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+996
-995
lines changed

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ MIT License
22

33
Copyright (c) 2016 Software Engineering Education - FOSS Resources
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
Permission is hereby granted, free of charge, to any recipe obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
77
in the Software without restriction, including without limitation the rights
88
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
9+
copies of the Software, and to permit recipes to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

1212
The above copyright notice and this permission notice shall be included in all

docs/DeveloperGuide.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]
100100

101101
. `Logic` uses the `AddressBookParser` class to parse the user command.
102102
. This results in a `Command` object which is executed by the `LogicManager`.
103-
. The command execution can affect the `Model` (e.g. adding a person).
103+
. The command execution can affect the `Model` (e.g. adding a recipe).
104104
. The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`.
105105
. In addition, the `CommandResult` object can also instruct the `Ui` to perform certain actions, such as displaying help to the user.
106106

@@ -173,18 +173,18 @@ Step 1. The user launches the application for the first time. The `VersionedAddr
173173

174174
image::UndoRedoState0.png[]
175175

176-
Step 2. The user executes `delete 5` command to delete the 5th person in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state.
176+
Step 2. The user executes `delete 5` command to delete the 5th recipe in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state.
177177

178178
image::UndoRedoState1.png[]
179179

180-
Step 3. The user executes `add n/David ...` to add a new person. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`.
180+
Step 3. The user executes `add n/David ...` to add a new recipe. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`.
181181

182182
image::UndoRedoState2.png[]
183183

184184
[NOTE]
185185
If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`.
186186

187-
Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoAddressBook()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous address book state, and restores the address book to that state.
187+
Step 4. The user now decides that adding the recipe was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoAddressBook()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous address book state, and restores the address book to that state.
188188

189189
image::UndoRedoState3.png[]
190190

@@ -222,7 +222,7 @@ image::CommitActivityDiagram.png[]
222222
** Pros: Easy to implement.
223223
** Cons: May have performance issues in terms of memory usage.
224224
* **Alternative 2:** Individual command knows how to undo/redo by itself.
225-
** Pros: Will use less memory (e.g. for `delete`, just save the person being deleted).
225+
** Pros: Will use less memory (e.g. for `delete`, just save the recipe being deleted).
226226
** Cons: We must ensure that the implementation of each individual command are correct.
227227

228228
===== Aspect: Data structure to support the undo/redo commands
@@ -515,15 +515,15 @@ These instructions only provide a starting point for testers to work on; testers
515515

516516
_{ more test cases ... }_
517517

518-
=== Deleting a person
518+
=== Deleting a recipe
519519

520-
. Deleting a person while all persons are listed
520+
. Deleting a recipe while all recipes are listed
521521

522-
.. Prerequisites: List all persons using the `list` command. Multiple persons in the list.
522+
.. Prerequisites: List all recipes using the `list` command. Multiple recipes in the list.
523523
.. Test case: `delete 1` +
524524
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.
525525
.. Test case: `delete 0` +
526-
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
526+
Expected: No recipe is deleted. Error details shown in the status message. Status bar remains the same.
527527
.. Other incorrect delete commands to try: `delete`, `delete x` (where x is larger than the list size) _{give more}_ +
528528
Expected: Similar to previous.
529529

docs/LearningOutcomes.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ What other user stories do you think AddressBook should support? Add those user
3333
=== Exercise: Add a 'Rename tag' use case
3434

3535
* Add a use case to the `DeveloperGuide.adoc` to cover the case of _renaming of an existing tag_.
36-
e.g. rename the tag `friends` to `buddies` (i.e. all persons who had the `friends` tag will now have
36+
e.g. rename the tag `friends` to `buddies` (i.e. all recipes who had the `friends` tag will now have
3737
a `buddies` tag instead)
3838
Assume that AddressBook confirms the change with the user before carrying out the operation.
3939

@@ -108,7 +108,7 @@ image::PrintableInterface.png[width=400]
108108
String getPrintableString(Printable... printables) {
109109
----
110110
+
111-
The above method can be used to get a printable string representing a bunch of person details.
111+
The above method can be used to get a printable string representing a bunch of recipe details.
112112
For example, you should be able to call that method like this:
113113
+
114114
[source,java]

docs/templates/LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ MIT License
55

66
Copyright (C) 2012-2018 Dan Allen, Ryan Waldron and the Asciidoctor Project
77

8-
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
Permission is hereby granted, free of charge, to any recipe obtaining a copy
99
of this software and associated documentation files (the "Software"), to deal
1010
in the Software without restriction, including without limitation the rights
1111
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12-
copies of the Software, and to permit persons to whom the Software is
12+
copies of the Software, and to permit recipes to whom the Software is
1313
furnished to do so, subject to the following conditions:
1414

1515
The above copyright notice and this permission notice shall be included in

docs/tutorials/AddRemark.adoc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ package seedu.address.logic.commands;
4141
import seedu.address.model.Model;
4242
4343
/**
44-
* Changes the remark of an existing person in the address book.
44+
* Changes the remark of an existing recipe in the address book.
4545
*/
4646
public class RemarkCommand extends Command {
4747
@@ -82,8 +82,8 @@ Following the convention in other commands, we add relevant messages as constant
8282
.RemarkCommand.java
8383
[source, java]
8484
----
85-
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the remark of the person identified "
86-
+ "by the index number used in the last person listing. "
85+
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the remark of the recipe identified "
86+
+ "by the index number used in the last recipe listing. "
8787
+ "Existing remark will be overwritten by the input.\n"
8888
+ "Parameters: INDEX (must be a positive integer) "
8989
+ "r/ [REMARK]\n"
@@ -120,8 +120,8 @@ public class RemarkCommand extends Command {
120120
private final String remark;
121121
122122
/**
123-
* @param index of the person in the filtered person list to edit the remark
124-
* @param remark of the person to be updated to
123+
* @param index of the recipe in the filtered recipe list to edit the remark
124+
* @param remark of the recipe to be updated to
125125
*/
126126
public RemarkCommand(Index index, String remark) {
127127
requireAllNonNull(index, remark);
@@ -246,12 +246,12 @@ If you are stuck, check out the sample link:https://github.com/nus-cs2103-AY1920
246246

247247
Now that we have all the information that we need, let's lay the groundwork for some _persistent_ changes.
248248
We achieve that by working with the `Person` model.
249-
Each field in a Person is implemented as a separate class (e.g. a `Name` object represents the person's name).
250-
That means we should add a `Remark` class so that we can use a `Remark` object to represent a remark given to a person.
249+
Each field in a Person is implemented as a separate class (e.g. a `Name` object represents the recipe's name).
250+
That means we should add a `Remark` class so that we can use a `Remark` object to represent a remark given to a recipe.
251251

252252
=== Add a new `Remark` class
253253

254-
Create a new `Remark` in `seedu.address.model.person`. Since a `Remark` is a field that is similar to `Address`, we can reuse a significant bit of code.
254+
Create a new `Remark` in `recipe`. Since a `Remark` is a field that is similar to `Address`, we can reuse a significant bit of code.
255255

256256
A copy-paste and search-replace later, you should have something like link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/b7a47c50c8e5f0430d343a23d2863446b6ce9298#diff-af2f075d24dfcd333876f0fbce321f25[this].
257257
Note how `Remark` has no constrains and thus does not require input validation.
@@ -263,7 +263,7 @@ These should be relatively simple changes.
263263

264264
== Add a placeholder element for remark to the UI
265265

266-
Without getting too deep into `fxml`, let's go on a 5 minute adventure to get some placeholder text to show up for each person.
266+
Without getting too deep into `fxml`, let's go on a 5 minute adventure to get some placeholder text to show up for each recipe.
267267

268268
Simply add
269269
[source, java]
@@ -326,9 +326,9 @@ Just add link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/5
326326
[source, java]
327327
.PersonCard.java
328328
----
329-
public PersonCard(Person person, int displayedIndex) {
329+
public PersonCard(Person recipe, int displayedIndex) {
330330
//...
331-
remark.setText(person.getRemark().value);
331+
remark.setText(recipe.getRemark().value);
332332
}
333333
----
334334

docs/tutorials/RemovingFields.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Fortunately, the IntelliJ IDEA provides a robust refactoring tool that can ident
2424
Let's try to use it as much as we can.
2525

2626
=== Assisted refactoring
27-
The `address` field in `Person` is actually an instance of the `seedu.address.model.person.Address` class.
27+
The `address` field in `Person` is actually an instance of the `seedu.address.model.recipe.Address` class.
2828
Since removing the `Address` class will break the application, we start by identifying ``Address``'s usages.
2929
This allows us to see code that depends on `Address` to function properly and edit them on a case-by-case basis.
3030
Right-click the `Address` class and select `Refactor` > `Safe Delete` through the menu.

src/main/java/seedu/address/MainApp.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import seedu.address.commons.util.StringUtil;
1616
import seedu.address.logic.Logic;
1717
import seedu.address.logic.LogicManager;
18-
import seedu.address.model.AddressBook;
18+
import seedu.address.model.RecipeBook;
1919
import seedu.address.model.Model;
2020
import seedu.address.model.ModelManager;
21-
import seedu.address.model.ReadOnlyAddressBook;
21+
import seedu.address.model.ReadOnlyRecipeBook;
2222
import seedu.address.model.ReadOnlyUserPrefs;
2323
import seedu.address.model.UserPrefs;
2424
import seedu.address.model.util.SampleDataUtil;
@@ -48,7 +48,7 @@ public class MainApp extends Application {
4848

4949
@Override
5050
public void init() throws Exception {
51-
logger.info("=============================[ Initializing AddressBook ]===========================");
51+
logger.info("=============================[ Initializing RecipeBook ]===========================");
5252
super.init();
5353

5454
AppParameters appParameters = AppParameters.parse(getParameters());
@@ -74,20 +74,20 @@ public void init() throws Exception {
7474
* or an empty address book will be used instead if errors occur when reading {@code storage}'s address book.
7575
*/
7676
private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
77-
Optional<ReadOnlyAddressBook> addressBookOptional;
78-
ReadOnlyAddressBook initialData;
77+
Optional<ReadOnlyRecipeBook> addressBookOptional;
78+
ReadOnlyRecipeBook initialData;
7979
try {
8080
addressBookOptional = storage.readAddressBook();
8181
if (!addressBookOptional.isPresent()) {
82-
logger.info("Data file not found. Will be starting with a sample AddressBook");
82+
logger.info("Data file not found. Will be starting with a sample RecipeBook");
8383
}
8484
initialData = addressBookOptional.orElseGet(SampleDataUtil::getSampleAddressBook);
8585
} catch (DataConversionException e) {
86-
logger.warning("Data file not in the correct format. Will be starting with an empty AddressBook");
87-
initialData = new AddressBook();
86+
logger.warning("Data file not in the correct format. Will be starting with an empty RecipeBook");
87+
initialData = new RecipeBook();
8888
} catch (IOException e) {
89-
logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook");
90-
initialData = new AddressBook();
89+
logger.warning("Problem while reading from the file. Will be starting with an empty RecipeBook");
90+
initialData = new RecipeBook();
9191
}
9292

9393
return new ModelManager(initialData, userPrefs);
@@ -151,7 +151,7 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) {
151151
+ "Using default user prefs");
152152
initializedPrefs = new UserPrefs();
153153
} catch (IOException e) {
154-
logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook");
154+
logger.warning("Problem while reading from the file. Will be starting with an empty RecipeBook");
155155
initializedPrefs = new UserPrefs();
156156
}
157157

@@ -167,7 +167,7 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) {
167167

168168
@Override
169169
public void start(Stage primaryStage) {
170-
logger.info("Starting AddressBook " + MainApp.VERSION);
170+
logger.info("Starting RecipeBook " + MainApp.VERSION);
171171
ui.start(primaryStage);
172172
}
173173

src/main/java/seedu/address/commons/core/Messages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class Messages {
77

88
public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
99
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
10-
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
10+
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The recipe index provided is invalid";
1111
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
1212

1313
}

src/main/java/seedu/address/logic/Logic.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import seedu.address.logic.commands.CommandResult;
88
import seedu.address.logic.commands.exceptions.CommandException;
99
import seedu.address.logic.parser.exceptions.ParseException;
10-
import seedu.address.model.ReadOnlyAddressBook;
11-
import seedu.address.model.person.Person;
10+
import seedu.address.model.ReadOnlyRecipeBook;
11+
import seedu.address.model.recipe.Recipe;
1212

1313
/**
1414
* API of the Logic component
@@ -24,14 +24,14 @@ public interface Logic {
2424
CommandResult execute(String commandText) throws CommandException, ParseException;
2525

2626
/**
27-
* Returns the AddressBook.
27+
* Returns the RecipeBook.
2828
*
2929
* @see seedu.address.model.Model#getAddressBook()
3030
*/
31-
ReadOnlyAddressBook getAddressBook();
31+
ReadOnlyRecipeBook getAddressBook();
3232

3333
/** Returns an unmodifiable view of the filtered list of persons */
34-
ObservableList<Person> getFilteredPersonList();
34+
ObservableList<Recipe> getFilteredPersonList();
3535

3636
/**
3737
* Returns the user prefs' address book file path.

src/main/java/seedu/address/logic/LogicManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import seedu.address.logic.parser.AddressBookParser;
1414
import seedu.address.logic.parser.exceptions.ParseException;
1515
import seedu.address.model.Model;
16-
import seedu.address.model.ReadOnlyAddressBook;
17-
import seedu.address.model.person.Person;
16+
import seedu.address.model.ReadOnlyRecipeBook;
17+
import seedu.address.model.recipe.Recipe;
1818
import seedu.address.storage.Storage;
1919

2020
/**
@@ -52,12 +52,12 @@ public CommandResult execute(String commandText) throws CommandException, ParseE
5252
}
5353

5454
@Override
55-
public ReadOnlyAddressBook getAddressBook() {
55+
public ReadOnlyRecipeBook getAddressBook() {
5656
return model.getAddressBook();
5757
}
5858

5959
@Override
60-
public ObservableList<Person> getFilteredPersonList() {
60+
public ObservableList<Recipe> getFilteredPersonList() {
6161
return model.getFilteredPersonList();
6262
}
6363

0 commit comments

Comments
 (0)