├── _config.yml
├── doc
├── Diagrams.pptx
├── images
│ ├── Ui.png
│ ├── mainClassDiagram.png
│ ├── DependencyInjection.png
│ ├── LogicStroageFileDIP.png
│ ├── PrintableInterface.png
│ ├── ReadOnlyPersonUsage.png
│ └── DependencyInjectionWithoutDIP.png
├── UserGuide.md
├── DeveloperGuide.md
└── LearningOutcomes.md
├── .travis.yml
├── test
├── data
│ └── StorageFileTest
│ │ ├── InvalidData.txt
│ │ └── ValidData.txt
└── java
│ └── seedu
│ └── addressbook
│ ├── util
│ └── TestUtil.java
│ ├── common
│ └── UtilsTest.java
│ ├── storage
│ └── StorageFileTest.java
│ ├── parser
│ └── ParserTest.java
│ └── logic
│ └── LogicTest.java
├── src
└── seedu
│ └── addressbook
│ ├── ui
│ ├── Stoppable.java
│ ├── DarkTheme.css
│ ├── mainwindow.fxml
│ ├── Gui.java
│ ├── Formatter.java
│ └── MainWindow.java
│ ├── data
│ ├── exception
│ │ ├── DuplicateDataException.java
│ │ └── IllegalValueException.java
│ ├── tag
│ │ ├── Tag.java
│ │ └── UniqueTagList.java
│ ├── person
│ │ ├── Address.java
│ │ ├── Phone.java
│ │ ├── Email.java
│ │ ├── Name.java
│ │ ├── Person.java
│ │ ├── ReadOnlyPerson.java
│ │ └── UniquePersonList.java
│ └── AddressBook.java
│ ├── commands
│ ├── IncorrectCommand.java
│ ├── ExitCommand.java
│ ├── ClearCommand.java
│ ├── ListCommand.java
│ ├── HelpCommand.java
│ ├── CommandResult.java
│ ├── ViewAllCommand.java
│ ├── ViewCommand.java
│ ├── DeleteCommand.java
│ ├── FindCommand.java
│ ├── Command.java
│ └── AddCommand.java
│ ├── common
│ ├── Messages.java
│ └── Utils.java
│ ├── Main.java
│ ├── storage
│ ├── jaxb
│ │ ├── AdaptedTag.java
│ │ ├── AdaptedAddressBook.java
│ │ └── AdaptedPerson.java
│ └── StorageFile.java
│ ├── logic
│ └── Logic.java
│ └── parser
│ └── Parser.java
├── .gitignore
├── LICENSE
└── README.md
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/doc/Diagrams.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/Diagrams.pptx
--------------------------------------------------------------------------------
/doc/images/Ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/Ui.png
--------------------------------------------------------------------------------
/doc/images/mainClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/mainClassDiagram.png
--------------------------------------------------------------------------------
/doc/images/DependencyInjection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/DependencyInjection.png
--------------------------------------------------------------------------------
/doc/images/LogicStroageFileDIP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/LogicStroageFileDIP.png
--------------------------------------------------------------------------------
/doc/images/PrintableInterface.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/PrintableInterface.png
--------------------------------------------------------------------------------
/doc/images/ReadOnlyPersonUsage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/ReadOnlyPersonUsage.png
--------------------------------------------------------------------------------
/doc/images/DependencyInjectionWithoutDIP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kokonguyen191/addressbook-level3/HEAD/doc/images/DependencyInjectionWithoutDIP.png
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 | matrix:
3 | include:
4 | - jdk: oraclejdk8
5 |
6 |
7 | addons:
8 | apt:
9 | packages:
10 | - oracle-java8-installer
11 |
--------------------------------------------------------------------------------
/test/data/StorageFileTest/InvalidData.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | data
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/ui/Stoppable.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.ui;
2 |
3 | /**
4 | * An App that can be stopped by calling the stop() method.
5 | */
6 | public interface Stoppable {
7 | public void stop() throws Exception;
8 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated class files
2 | *.class
3 |
4 | # Default data file
5 | addressbook.txt
6 |
7 | # Package Files #
8 | *.jar
9 | *.war
10 | *.ear
11 |
12 | # Idea files
13 | .idea/
14 | *.iml
15 | out/
16 | test/data/
17 | /bin/
18 | /data/
19 | publish.sh
20 |
21 | # Gradle build files
22 | .gradle/
23 | build/
24 |
25 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/data/exception/DuplicateDataException.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.data.exception;
2 |
3 | /**
4 | * Signals an error caused by duplicate data where there should be none.
5 | */
6 | public abstract class DuplicateDataException extends IllegalValueException {
7 | public DuplicateDataException(String message) {
8 | super(message);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/data/exception/IllegalValueException.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.data.exception;
2 |
3 | /**
4 | * Signals that some given data does not fulfill some constraints.
5 | */
6 | public class IllegalValueException extends Exception {
7 | /**
8 | * @param message should contain relevant information on the failed constraint(s)
9 | */
10 | public IllegalValueException(String message) {
11 | super(message);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/ui/DarkTheme.css:
--------------------------------------------------------------------------------
1 |
2 |
3 | .text-field {
4 | -fx-font-size: 12pt;
5 | -fx-font-family: "Consolas";
6 | -fx-font-weight: bold;
7 | -fx-text-fill: yellow;
8 | -fx-control-inner-background: derive(#1d1d1d,20%);
9 | }
10 |
11 | .text-area {
12 | -fx-background-color: black;
13 | -fx-control-inner-background: black;
14 | -fx-font-family: "Segoe UI Semibold";
15 | -fx-font-size: 10pt;
16 | -fx-padding: 5 5 5 5;
17 | }
18 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/commands/IncorrectCommand.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.commands;
2 |
3 |
4 | /**
5 | * Represents an incorrect command. Upon execution, produces some feedback to the user.
6 | */
7 | public class IncorrectCommand extends Command{
8 |
9 | public final String feedbackToUser;
10 |
11 | public IncorrectCommand(String feedbackToUser){
12 | this.feedbackToUser = feedbackToUser;
13 | }
14 |
15 | @Override
16 | public CommandResult execute() {
17 | return new CommandResult(feedbackToUser);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/commands/ExitCommand.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.commands;
2 |
3 | /**
4 | * Terminates the program.
5 | */
6 | public class ExitCommand extends Command {
7 |
8 | public static final String COMMAND_WORD = "exit";
9 |
10 | public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Exits the program.\n\t"
11 | + "Example: " + COMMAND_WORD;
12 | public static final String MESSAGE_EXIT_ACKNOWEDGEMENT = "Exiting Address Book as requested ...";
13 |
14 | @Override
15 | public CommandResult execute() {
16 | return new CommandResult(MESSAGE_EXIT_ACKNOWEDGEMENT);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/commands/ClearCommand.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.commands;
2 |
3 | /**
4 | * Clears the address book.
5 | */
6 | public class ClearCommand extends Command {
7 |
8 | public static final String COMMAND_WORD = "clear";
9 | public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Clears address book permanently.\n\t"
10 | + "Example: " + COMMAND_WORD;
11 |
12 | public static final String MESSAGE_SUCCESS = "Address book has been cleared!";
13 |
14 | @Override
15 | public CommandResult execute() {
16 | addressBook.clear();
17 | return new CommandResult(MESSAGE_SUCCESS);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/ui/mainwindow.fxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/test/data/StorageFileTest/ValidData.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | John Doe
5 | 98765432
6 | johnd@gmail.com
7 | John street, block 123, #01-01
8 |
9 |
10 | Betsy Crowe
11 | 1234567
12 | betsycrowe@gmail.com
13 | Newgate Prison
14 | friend
15 | criminal
16 |
17 | friend
18 | criminal
19 |
20 |
--------------------------------------------------------------------------------
/test/java/seedu/addressbook/util/TestUtil.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.util;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import java.io.IOException;
5 | import java.nio.charset.Charset;
6 | import java.nio.file.Files;
7 | import java.nio.file.Path;
8 | import java.util.List;
9 |
10 | public class TestUtil {
11 | /**
12 | * Asserts whether the text in the two given files are the same. Ignores any
13 | * differences in line endings
14 | */
15 | public static void assertTextFilesEqual(Path path1, Path path2) throws IOException {
16 | List list1 = Files.readAllLines(path1, Charset.defaultCharset());
17 | List list2 = Files.readAllLines(path2, Charset.defaultCharset());
18 | assertEquals(String.join("\n", list1), String.join("\n", list2));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/commands/ListCommand.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.commands;
2 |
3 | import seedu.addressbook.data.person.ReadOnlyPerson;
4 |
5 | import java.util.List;
6 |
7 |
8 | /**
9 | * Lists all persons in the address book to the user.
10 | */
11 | public class ListCommand extends Command {
12 |
13 | public static final String COMMAND_WORD = "list";
14 |
15 | public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
16 | + "Displays all persons in the address book as a list with index numbers.\n\t"
17 | + "Example: " + COMMAND_WORD;
18 |
19 |
20 | @Override
21 | public CommandResult execute() {
22 | List allPersons = addressBook.getAllPersons().immutableListView();
23 | return new CommandResult(getMessageForPersonListShownSummary(allPersons), allPersons);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/common/Messages.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.common;
2 |
3 | /**
4 | * Container for user visible messages.
5 | */
6 | public class Messages {
7 |
8 | public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
9 | public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
10 | public static final String MESSAGE_PERSON_NOT_IN_ADDRESSBOOK = "Person could not be found in address book";
11 | public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
12 | public static final String MESSAGE_PROGRAM_LAUNCH_ARGS_USAGE = "Launch command format: " +
13 | "java seedu.addressbook.Main [STORAGE_FILE_PATH]";
14 | public static final String MESSAGE_WELCOME = "Welcome to your Address Book!";
15 | public static final String MESSAGE_USING_STORAGE_FILE = "Using storage file : %1$s";
16 | }
17 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/commands/HelpCommand.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.commands;
2 |
3 |
4 | /**
5 | * Shows help instructions.
6 | */
7 | public class HelpCommand extends Command {
8 |
9 | public static final String COMMAND_WORD = "help";
10 |
11 | public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" +"Shows program usage instructions.\n\t"
12 | + "Example: " + COMMAND_WORD;
13 |
14 | public static final String MESSAGE_ALL_USAGES = AddCommand.MESSAGE_USAGE
15 | + "\n" + DeleteCommand.MESSAGE_USAGE
16 | + "\n" + ClearCommand.MESSAGE_USAGE
17 | + "\n" + FindCommand.MESSAGE_USAGE
18 | + "\n" + ListCommand.MESSAGE_USAGE
19 | + "\n" + ViewCommand.MESSAGE_USAGE
20 | + "\n" + ViewAllCommand.MESSAGE_USAGE
21 | + "\n" + HelpCommand.MESSAGE_USAGE
22 | + "\n" + ExitCommand.MESSAGE_USAGE;
23 |
24 | @Override
25 | public CommandResult execute() {
26 | return new CommandResult(MESSAGE_ALL_USAGES);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/Main.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook;
2 |
3 | import javafx.application.Application;
4 | import javafx.application.Platform;
5 |
6 | import javafx.stage.Stage;
7 | import seedu.addressbook.logic.Logic;
8 | import seedu.addressbook.ui.Gui;
9 | import seedu.addressbook.ui.Stoppable;
10 |
11 | /**
12 | * Main entry point to the application.
13 | */
14 | public class Main extends Application implements Stoppable{
15 |
16 | /** Version info of the program. */
17 | public static final String VERSION = "AddressBook Level 3 - Version 1.0";
18 |
19 | private Gui gui;
20 |
21 | @Override
22 | public void start(Stage primaryStage) throws Exception{
23 | gui = new Gui(new Logic(), VERSION);
24 | gui.start(primaryStage, this);
25 | }
26 |
27 | @Override
28 | public void stop() throws Exception {
29 | super.stop();
30 | Platform.exit();
31 | System.exit(0);
32 | }
33 |
34 | public static void main(String[] args) {
35 | launch(args);
36 | }
37 | }
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/seedu/addressbook/common/Utils.java:
--------------------------------------------------------------------------------
1 | package seedu.addressbook.common;
2 |
3 | import java.util.Collection;
4 | import java.util.HashSet;
5 | import java.util.Set;
6 |
7 | /**
8 | * Utility methods
9 | */
10 | public class Utils {
11 |
12 | /**
13 | * Checks whether any of the given items are null.
14 | */
15 | public static boolean isAnyNull(Object... items) {
16 | for (Object item : items) {
17 | if (item == null) {
18 | return true;
19 | }
20 | }
21 | return false;
22 | }
23 |
24 | /**
25 | * Checks if every element in a collection are unique by {@link Object#equals(Object)}.
26 | */
27 | public static boolean elementsAreUnique(Collection> items) {
28 | final Set