forked from nus-cs2103-AY1819S2/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'documentation' into update-documentation
- Loading branch information
Showing
43 changed files
with
1,388 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
= Jonathan Choo - Project Portfolio | ||
:site-section: AboutUs | ||
:imagesDir: ../images | ||
:stylesDir: ../stylesheets | ||
|
||
== PROJECT: AddressBook - Level 4 | ||
|
||
--- | ||
|
||
== Overview | ||
|
||
AddressBook - Level 4 is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC. | ||
|
||
== Summary of contributions | ||
|
||
* *Major enhancement*: added *the ability to undo/redo previous commands* | ||
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. | ||
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. | ||
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. | ||
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ | ||
|
||
* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys. | ||
|
||
* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ | ||
|
||
* *Other contributions*: | ||
|
||
** Project management: | ||
*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub | ||
** Enhancements to existing features: | ||
*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) | ||
*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) | ||
** Documentation: | ||
*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] | ||
** Community: | ||
*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] | ||
*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) | ||
*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) | ||
*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) | ||
** Tools: | ||
*** Integrated a third party library (Natty) to the project (https://github.com[#42]) | ||
*** Integrated a new Github plugin (CircleCI) to the team repo | ||
|
||
_{you can add/remove categories in the list above}_ | ||
|
||
== Contributions to the User Guide | ||
|
||
|
||
|=== | ||
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ | ||
|=== | ||
|
||
include::../UserGuide.adoc[tag=undoredo] | ||
|
||
include::../UserGuide.adoc[tag=dataencryption] | ||
|
||
== Contributions to the Developer Guide | ||
|
||
|=== | ||
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ | ||
|=== | ||
|
||
include::../DeveloperGuide.adoc[tag=undoredo] | ||
|
||
include::../DeveloperGuide.adoc[tag=dataencryption] | ||
|
||
|
||
== PROJECT: PowerPointLabs | ||
|
||
--- | ||
|
||
_{Optionally, you may include other projects in your portfolio.}_ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/seedu/address/logic/commands/CopyCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import java.util.List; | ||
|
||
import seedu.address.commons.core.Messages; | ||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.CommandHistory; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
|
||
/** | ||
* Adds a person to the address book. | ||
*/ | ||
public class CopyCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "copy"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Have a temporary duplicate person in the addressbook. " | ||
+ "Parameters: Index (Must be an integer)" | ||
+ "Example: " + COMMAND_WORD + " 1 "; | ||
|
||
public static final String MESSAGE_SUCCESS = "Person copied: %1$s"; | ||
|
||
private final Index index; | ||
|
||
/** | ||
* Creates an AddCommand to add the specified {@code Person} | ||
*/ | ||
public CopyCommand(Index index) { | ||
requireNonNull(index); | ||
this.index = index; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model, CommandHistory history) throws CommandException { | ||
requireNonNull(model); | ||
List<Person> lastShownList = model.getFilteredPersonList(); | ||
|
||
if (index.getZeroBased() >= lastShownList.size()) { | ||
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX); | ||
} | ||
|
||
Person personToCopy = lastShownList.get(index.getZeroBased()); | ||
Person copyPerson = personToCopy.copy(); | ||
|
||
model.addPerson(copyPerson); | ||
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); | ||
model.commitAddressBook(); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, copyPerson)); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof CopyCommand // instanceof handles nulls | ||
&& index.equals(((CopyCommand) other).index)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/java/seedu/address/logic/commands/ExportCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
import seedu.address.MainApp; | ||
import seedu.address.commons.core.LogsCenter; | ||
import seedu.address.logic.CommandHistory; | ||
import seedu.address.model.Model; | ||
import seedu.address.storage.AddressBookStorage; | ||
import seedu.address.storage.JsonAddressBookStorage; | ||
import seedu.address.storage.StorageManager; | ||
|
||
/** | ||
* Exports records to a text file. | ||
*/ | ||
public class ExportCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "export"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD | ||
+ ": Exports to text file in the \"data\" folder \n" | ||
+ "Parameters: FILENAME\n" | ||
+ "Example: " + COMMAND_WORD + " records1.json"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Exported the records!"; | ||
private static final String MESSAGE_FAILURE = "Problem while writing to the file."; | ||
|
||
private final File file; | ||
|
||
public ExportCommand(File file) { | ||
this.file = file; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model, CommandHistory history) { | ||
requireNonNull(model); | ||
writeFile(model); | ||
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); | ||
return new CommandResult(MESSAGE_SUCCESS); | ||
} | ||
|
||
/** | ||
* writeFile() writes or overwrites a file with the contents of the current address book. | ||
*/ | ||
private void writeFile(Model model) { | ||
AddressBookStorage addressBookStorage = new JsonAddressBookStorage(file.toPath()); | ||
|
||
StorageManager storage = new StorageManager(addressBookStorage, null); | ||
|
||
final Logger logger = LogsCenter.getLogger(MainApp.class); | ||
|
||
try { | ||
storage.saveAddressBook(model.getAddressBook(), file.toPath()); | ||
} catch (IOException e) { | ||
logger.warning(MESSAGE_FAILURE); | ||
} | ||
} | ||
} |
Oops, something went wrong.