diff --git a/.gitignore b/.gitignore index 5e59b862ba4..566cbda3e0a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ src/main/resources/docs/ # IDEA files /.idea/ /out/ -/*.iml +**/*.iml # Storage/log files /data/ @@ -19,3 +19,8 @@ src/test/data/sandbox/ # MacOS custom attributes files created by Finder .DS_Store + +# Custom Windows / Shell scripts +*.bat + + diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.adoc b/README.adoc old mode 100644 new mode 100755 index e36efe534bb..452705fb03a --- a/README.adoc +++ b/README.adoc @@ -1,10 +1,9 @@ -= Address Book (Level 3) += Inventory Manager ifdef::env-github,env-browser[:relfileprefix: docs/] -https://travis-ci.org/se-edu/addressbook-level3[image:https://travis-ci.org/se-edu/addressbook-level3.svg?branch=master[Build Status]] -https://ci.appveyor.com/project/damithc/addressbook-level3[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]] -https://coveralls.io/github/se-edu/addressbook-level3?branch=master[image:https://coveralls.io/repos/github/se-edu/addressbook-level3/badge.svg?branch=master[Coverage Status]] -https://www.codacy.com/app/damith/addressbook-level3?utm_source=github.com&utm_medium=referral&utm_content=se-edu/addressbook-level3&utm_campaign=Badge_Grade[image:https://api.codacy.com/project/badge/Grade/fc0b7775cf7f4fdeaf08776f3d8e364a[Codacy Badge]] +https://travis-ci.org/AY1920S2-CS2103-W14-2/main[image:https://travis-ci.org/AY1920S2-CS2103-W14-2/main.svg?branch=master[Build Status]] +https://ci.appveyor.com/project/CS2103-W14-2/main[image:https://ci.appveyor.com/api/projects/status/rlr0xji2vhij1016?svg=true[Build status]] +https://coveralls.io/github/AY1920S2-CS2103-W14-2/main?branch=master[image:https://coveralls.io/repos/github/AY1920S2-CS2103-W14-2/main/badge.svg?branch=master[Coverage Status]] ifdef::env-github[] @@ -15,9 +14,15 @@ ifndef::env-github[] image::images/Ui.png[width="600"] endif::[] -* This is a desktop Address Book application. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface). -* It is a Java sample application intended for students learning Software Engineering while using Java as the main programming language. -* It is *written in OOP fashion*. It provides a *reasonably well-written* code example that is *significantly bigger* (around 6 KLoC)than what students usually write in beginner-level SE modules. +* This is a desktop Inventory Manager application. It has a GUI but most of the user interactions happen using a CLI (Command Line Interface). +* It facilitates easily management of stocks, which includes: + ** warning when supplies are + low + ** easy sourcing of suppliers for selected goods + ** expiry management + ** seamless updating of inventory upon procurement and sales transactions +* This application is optimized for fast-typists. If you are comfortable with the keyboard, +Inventory Manager will be a joy to use! == Site Map @@ -32,5 +37,6 @@ endif::[] * Some parts of this sample application were inspired by the excellent http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by _Marco Jakob_. * Libraries used: https://openjfx.io/[JavaFX], https://github.com/FasterXML/jackson[Jackson], https://github.com/junit-team/junit5[JUnit5] +* This project is an extension of AddressBook-Level3 project codebase created by https://se-education.org[SE-EDU initiative] == Licence : link:LICENSE[MIT] diff --git a/_config.yml b/_config.yml old mode 100644 new mode 100755 diff --git a/appveyor.yml b/appveyor.yml old mode 100644 new mode 100755 diff --git a/build.gradle b/build.gradle old mode 100644 new mode 100755 index 93029ef8262..600e4db395a --- a/build.gradle +++ b/build.gradle @@ -67,7 +67,7 @@ dependencies { } shadowJar { - archiveName = 'addressbook.jar' + archiveName = 'inventorymanager.jar' destinationDir = file("${buildDir}/jar/") } @@ -133,8 +133,8 @@ asciidoctor { idprefix: '', // for compatibility with GitHub preview idseparator: '-', 'site-root': "${sourceDir}", // must be the same as sourceDir, do not modify - 'site-name': 'AddressBook-Level3', - 'site-githuburl': 'https://github.com/se-edu/addressbook-level3', + 'site-name': 'InventoryManager', + 'site-githuburl': 'https://github.com/AY1920S2-CS2103-W14-2/main', 'site-seedu': true, // delete this line if your project is not a fork (not a SE-EDU project) ] diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml old mode 100644 new mode 100755 diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml old mode 100644 new mode 100755 diff --git a/copyright.txt b/copyright.txt old mode 100644 new mode 100755 index 93aa2a39ce2..2b62a7d55e0 --- a/copyright.txt +++ b/copyright.txt @@ -1,8 +1,7 @@ Some code adapted from http://code.makery.ch/library/javafx-8-tutorial/ by Marco Jakob -Copyright by Susumu Yoshida - http://www.mcdodesign.com/ -- address_book_32.png -- AddressApp.ico +Copyright by Iconfactory - https://iconfactory.com/ +- inventory_manager_32.png Copyright by Jan Jan Kovařík - http://glyphicons.com/ - calendar.png diff --git a/docs/AboutUs.adoc b/docs/AboutUs.adoc old mode 100644 new mode 100755 index 458e6134f45..5e6b1d65410 --- a/docs/AboutUs.adoc +++ b/docs/AboutUs.adoc @@ -4,53 +4,42 @@ :imagesDir: images :stylesDir: stylesheets -AddressBook - Level 3 was developed by the https://se-edu.github.io/docs/Team.html[se-edu] team. + -_{The dummy content given below serves as a placeholder to be used by future forks of the project.}_ + -{empty} + We are a team based in the http://www.comp.nus.edu.sg[School of Computing, National University of Singapore]. == Project Team -=== John Doe -image::damithc.jpg[width="150", align="left"] -{empty}[http://www.comp.nus.edu.sg/~damithch[homepage]] [https://github.com/damithc[github]] [<>] +=== Nicholas Cristian Fernando +image::nicholascf.png[width="150", align="left"] +{empty}[https://github.com/NicholasCF[github]] [<>] -Role: Project Advisor - -''' - -=== John Roe -image::lejolly.jpg[width="150", align="left"] -{empty}[http://github.com/lejolly[github]] [<>] - -Role: Team Lead + -Responsibilities: UI +Role: Developer + +Responsibilities: Suppliers ''' -=== Johnny Doe -image::yijinl.jpg[width="150", align="left"] -{empty}[http://github.com/yijinl[github]] [<>] +=== Pang Jia Da +image::pangjiada.png[width="150", align="left"] +{empty}[https://github.com/PangJiaDa[github]] [<>] Role: Developer + -Responsibilities: Data +Responsibilities: Transactions ''' -=== Johnny Roe -image::m133225.jpg[width="150", align="left"] -{empty}[http://github.com/m133225[github]] [<>] +=== Fang Shao Hua +image::fangshaohua94.png[width="150", align="left"] +{empty}[https://github.com/FangShaoHua94[github]] [<>] Role: Developer + -Responsibilities: Dev Ops + Threading +Responsibilities: Inventory ''' -=== Benson Meier -image::yl_coder.jpg[width="150", align="left"] -{empty}[http://github.com/yl-coder[github]] [<>] +=== Liu Chao +image::liuchao93.png[width="150", align="left"] +{empty}[https://github.com/LiuChao93[github]] [<>] Role: Developer + -Responsibilities: UI +Responsibilities: Suppliers ''' diff --git a/docs/ContactUs.adoc b/docs/ContactUs.adoc old mode 100644 new mode 100755 index 81be279ef6d..05bde4d04f5 --- a/docs/ContactUs.adoc +++ b/docs/ContactUs.adoc @@ -2,6 +2,10 @@ :site-section: ContactUs :stylesDir: stylesheets -* *Bug reports, Suggestions* : Post in our https://github.com/se-edu/addressbook-level3/issues[issue tracker] if you noticed bugs or have suggestions on how to improve. +* *Bug reports, Suggestions* : Post in our https://github.com/AY1920S2-CS2103-W14-2/main/issues[issue tracker] if you noticed bugs or have suggestions on how to improve. * *Contributing* : We welcome pull requests. Follow the process described https://github.com/oss-generic/process[here] -* *Email us* : You can also reach us at `damith [at] comp.nus.edu.sg` +* *Email us* : You can also reach us at +** `liu.chao5793@gmail.com` +** `nicholas.fernando@u.nus.edu` +** `e0203379@u.nus.edu` +** `pangjiada@u.nus.edu` diff --git a/docs/DevOps.adoc b/docs/DevOps.adoc deleted file mode 100644 index 2aa5a6bc0c1..00000000000 --- a/docs/DevOps.adoc +++ /dev/null @@ -1,48 +0,0 @@ -= AddressBook Level 3 - Dev Ops -:site-section: DeveloperGuide -:toc: -:toc-title: -:toc-placement: preamble -:sectnums: -:imagesDir: images -:stylesDir: stylesheets -:xrefstyle: full -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -:warning-caption: :warning: -endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3/tree/master - -== Build Automation - -See <> to learn how to use Gradle for build automation. - -== Continuous Integration - -We use https://travis-ci.org/[Travis CI] and https://www.appveyor.com/[AppVeyor] to perform _Continuous Integration_ on our projects. See <> and <> for more details. - -== Coverage Reporting - -We use https://coveralls.io/[Coveralls] to track the code coverage of our projects. See <> for more details. - -== Documentation Previews - -When a pull request has changes to asciidoc files, you can use https://www.netlify.com/[Netlify] to see a preview of how the HTML version of those asciidoc files will look like when the pull request is merged. See <> for more details. - -== Making a Release - -Here are the steps to create a new release. - -. Update the version number in link:{repoURL}/src/main/java/seedu/address/MainApp.java[`MainApp.java`]. -. Generate a JAR file <>. -. Tag the repo with the version number. e.g. `v0.1` -. https://help.github.com/articles/creating-releases/[Create a new release using GitHub] and upload the JAR file you created. - -== Managing Dependencies - -A project often depends on third-party libraries. For example, Address Book depends on the https://github.com/FasterXML/jackson[Jackson library] for JSON parsing. Managing these _dependencies_ can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives: - -[loweralpha] -. Include those libraries in the repo (this bloats the repo size) -. Require developers to download those libraries manually (this creates extra work for developers) diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc old mode 100644 new mode 100755 index 3d65905a853..182820fce59 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -1,4 +1,4 @@ -= AddressBook Level 3 - Developer Guide += InventoryManager v1.2 - Developer Guide :site-section: DeveloperGuide :toc: :toc-title: @@ -12,9 +12,9 @@ ifdef::env-github[] :note-caption: :information_source: :warning-caption: :warning: endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3/tree/master +:repoURL: https://github.com/AY1920S2-CS2103-W14-2/main/tree/master -By: `Team SE-EDU`      Since: `Jun 2016`      Licence: `MIT` +By: `AY1920S2-CS2103-W14-2`      Since: `Feb 2020`      Licence: `MIT` == Setting up @@ -64,9 +64,9 @@ image::LogicClassDiagram.png[] [discrete] ==== How the architecture components interact with each other -The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1`. +The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete-s 1`. -.Component interactions for `delete 1` command +.Component interactions for `delete-s 1` command image::ArchitectureSequenceDiagram.png[] The sections below give more details of each component. @@ -79,7 +79,7 @@ image::UiClassDiagram.png[] *API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`] -The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class. +The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `SupplierListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class. The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`] @@ -100,16 +100,16 @@ link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`] . `Logic` uses the `AddressBookParser` class to parse the user command. . This results in a `Command` object which is executed by the `LogicManager`. -. The command execution can affect the `Model` (e.g. adding a person). +. The command execution can affect the `Model` (e.g. adding a supplier). . The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`. . In addition, the `CommandResult` object can also instruct the `Ui` to perform certain actions, such as displaying help to the user. -Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("delete 1")` API call. +Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("buy g/Apple q/50")` API call. -.Interactions Inside the Logic Component for the `delete 1` Command -image::DeleteSequenceDiagram.png[] +.Interactions Inside the Logic Component for the `buy g/Apple q/50` Command +image::BuySequenceDiagram.png[] -NOTE: The lifeline for `DeleteCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. +NOTE: The lifeline for `BuyCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. [[Design-Model]] === Model component @@ -122,14 +122,39 @@ image::ModelClassDiagram.png[] The `Model`, * stores a `UserPref` object that represents the user's preferences. -* stores the Address Book data. -* exposes an unmodifiable `ObservableList` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. +* stores the 3 sets of data: `AddressBook`, `Inventory` and `TransactionHistory`. +* these 3 sets of data stores `Supplier`, `Good` and `Transaction` respectively. +* have close interaction between each other through various commands input. +* exposes 3 sets of unmodifiable list: `ObservableList`, `ObservableList` and `ObservableList` that can be 'observed' as 3 separate panels on the UI. e.g. the UI can be bound to this list so that the UI automatically updates when any of the data in the list change. * does not depend on any of the other three components. -[NOTE] -As a more OOP model, we can store a `Tag` list in `Address Book`, which `Person` can reference. This would allow `Address Book` to only require one `Tag` object per unique `Tag`, instead of each `Person` needing their own `Tag` object. An example of how such a model may look like is given below. + - + -image:BetterModelClassDiagram.png[] +The `Supplier`, + +* stores details of supplier: `Name`, `Phone`, `Address`, `Email` and `Offer`. +* can have no `Offer` or multiple `Offer`. + +image:SupplierModelClassDiagram.png[] + +The `Offer`, + +* compose of `GoodName` and `Price`, indicating the supplier offer to sell a specific good with a specific price. + +image:OfferModelClassDiagram.png[] + +The `Good`, + +* stores details of good: `GoodName`, `Quantity` and `ThresholdQuantity`. + +image:GoodModelClassDiagram.png[] + +The `Transaction`, + +* stores details of transaction: `TransactionId`, `Good` and `Quantity`. +* differentiate by two types: `SellTransaction` and `BuyTransaction`. +* `SellTransaction` stores additional detail: `Price` which is selling price of the good. +* `BuyTransaction` stores additional details: `Price` and `Supplier`, which are the buying price of the good and the seller of the good respectively. + +image:TransactionModelClassDiagram.png[] [[Design-Storage]] === Storage component @@ -142,7 +167,7 @@ image::StorageClassDiagram.png[] The `Storage` component, * can save `UserPref` objects in json format and read it back. -* can save the Address Book data in json format and read it back. +* can save 3 sets of data: `AddressBook`, `Inventory` and `TransactionHistory` in json format, save them in separate json file and read the data back. [[Design-Commons]] === Common classes @@ -157,88 +182,131 @@ This section describes some noteworthy details on how certain features are imple === [Proposed] Undo/Redo feature ==== Proposed Implementation -The undo/redo mechanism is facilitated by `VersionedAddressBook`. -It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`. -Additionally, it implements the following operations: +The undo/redo mechanism is facilitated by `VersionedInventory`, `VersionedSupplierList` and `VersionedTransactionHistory` for `Good`, `Supplier` and `Transaction` data respectively. Due to the almost identical implementation of these three classes for database management, these classes will henceforth be generalised as `VersionedDatabaseManager`. + +`VersionedDatabaseManager` extends its non-versioned counterpart `DatabaseManager` with a history of states as a `databaseStateList` and a `currentStatePointer`. Additionally, it implements the following operations: -* `VersionedAddressBook#commit()` -- Saves the current address book state in its history. -* `VersionedAddressBook#undo()` -- Restores the previous address book state from its history. -* `VersionedAddressBook#redo()` -- Restores a previously undone address book state from its history. +* `VersionedDatabaseManager#commit()` -- Adds the current database state to the tracked states. +* `VersionedDatabaseManager#undo()` -- Restores the previous database state. +* `VersionedDatabaseManager#redo()` -- Restores the most recently undone database state. -These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively. +These operations are exposed in the `Model` interface as `Model#commit()`, `Model#undo()` and `Model#redo` respectively. Each call of these methods will call the respective methods of each of the `VersionedDatabaseManager` of `Good`, `Supplier` and `Transaction`. + +The sequence diagram below illustrates the events that occur when a user calls the undo command assuming it is possible to do so, for clarity: + +image::UndoSequenceDiagram.png[] + +NOTE: The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. Given below is an example usage scenario and how the undo/redo mechanism behaves at each step. -Step 1. The user launches the application for the first time. The `VersionedAddressBook` will be initialized with the initial address book state, and the `currentStatePointer` pointing to that single address book state. +Step 1. The user launches the application for the first time. For each category, the `VersionedDatabaseManager` will be initialized with the respective initial database state, with the `currentStatePointer` pointing to that single database state. image::UndoRedoState0.png[] -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. +Step 2. The user executes `delete-s 5` command to delete the 5th supplier in the supplier list. The `delete-s` command calls `Model#commit()` since it modifies the database, causing the database state after the `delete-s 5` command executes to be saved in the `databaseStateList`, and the `currentStatePointer` is shifted to the newly inserted database state. This also applies to the `VersionedDatabase` for `Good` and `Transaction` even if there are no changes to them. image::UndoRedoState1.png[] -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`. +Step 3. The user executes `add-s n/David ...` to add a new supplier. The `add-s` command also calls `Model#commit()` as it modifies the database, causing another modified database state to be saved into the `databaseStateList`. image::UndoRedoState2.png[] [NOTE] -If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`. +If a command fails its execution, it will not call `Model#commit()`, so the database state will not be saved into the `databaseStateList`. -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. +Step 4. The user now decides that adding the supplier was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undo()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous database state, and restores the database to that state. image::UndoRedoState3.png[] [NOTE] -If the `currentStatePointer` is at index 0, pointing to the initial address book state, then there are no previous address book states to restore. The `undo` command uses `Model#canUndoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo. - -The following sequence diagram shows how the undo operation works: +If the `currentStatePointer` is at index 0, pointing to the initial database state, then there are no previous database states to restore. The `undo` command uses `Model#canUndo()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo. -image::UndoSequenceDiagram.png[] - -NOTE: The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram. - -The `redo` command does the opposite -- it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state. +The `redo` command does the opposite -- it calls `Model#redo()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the database to that state. [NOTE] -If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone address book states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. +If the `currentStatePointer` is at index `databaseList.size() - 1`, pointing to the latest database state, then there are no undone database states to restore. The `redo` command uses `Model#canRedo()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo. -Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged. +Step 5. The user then decides to execute the command `list-s`. Commands that do not modify any database, such as `list-s`, will usually not call `Model#commit()`, `Model#undo()` or `Model#redo()`. Thus, the `databaseStateList` remains unchanged. image::UndoRedoState4.png[] -Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow. +Step 6. The user executes `clear-s`, which calls `Model#commit()`. Since there is a branching in history, all database states after the `currentStatePointer` will be purged. This prevents conflicts from redoing commands from a diverged history e.g. editing a supplier named Jane when Jane was deleted in the new history. Furthermore, there are many mainstream editing software that exhibits this behaviour. image::UndoRedoState5.png[] -The following activity diagram summarizes what happens when a user executes a new command: - -image::CommitActivityDiagram.png[] - ==== Design Considerations ===== Aspect: How undo & redo executes -* **Alternative 1 (current choice):** Saves the entire address book. -** Pros: Easy to implement. -** Cons: May have performance issues in terms of memory usage. +* **Alternative 1 (current choice):** Saves the entire databases. +** Pros: Trivial implementation. +** Cons: May encounter performance issues due to memory load, especially with three different databases. * **Alternative 2:** Individual command knows how to undo/redo by itself. -** Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). +** Pros: Will use less memory (e.g. for `delete-s`, just save the supplier being deleted). ** Cons: We must ensure that the implementation of each individual command are correct. -===== Aspect: Data structure to support the undo/redo commands +===== Aspect: When to save history -* **Alternative 1 (current choice):** Use a list to store the history of address book states. -** Pros: Easy for new Computer Science student undergraduates to understand, who are likely to be the new incoming developers of our project. -** Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both `HistoryManager` and `VersionedAddressBook`. -* **Alternative 2:** Use `HistoryManager` for undo/redo -** Pros: We do not need to maintain a separate list, and just reuse what is already in the codebase. -** Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as `HistoryManager` now needs to do two different things. +* **Alternative 1 (current choice) :** Save all three databases even when only one database is modified. +** Pros: Easy to implement. +** Cons: Inefficient memory usage, especially when only one database is being modified in each action. +* **Alternative 2:** Save a database only when that database is modified. +** Pros: Saves memory usage that could be used for performance. +** Cons: Requires information on which databases are affected by a command, which breaks abstraction on both the VersionedDatabase and commands. + +===== Aspect: How storage of states is implemented + +* **Alternative 1 (current choice) :** Store states as objects during Java runtime +** Pros: Simple implementation and automatic cleanup. +** Cons: Segmentation fault may occur for very long sessions and large databases. +* **Alternative 2:** Store states in an external file +** Pros: Less memory usage, leading to better performance. +** Cons: File I/O may incur comparable overhead for smaller databases, and abrupt termination of the application may result in temporary files being left behind and cluttering space. // end::undoredo[] // tag::dataencryption[] -=== [Proposed] Data Encryption +=== Data Encryption +==== Proposed Implementation +The data encryption adn decryption mechanism is facilitated by `FileCryptoUtil`. The crypto algorithm employed is Advanced +Encryption Standard (AES) under symmetric encryption algorithm, where both the encryption and decryption uses same key. + +`FileCryptoUtil` will implement the following operations: +`FileCryptoUtil#encryptFile()` -- encrypts human readable Json file into unreadable encrypted file. +`FileCryptoUtil#decryptFile()` -- decrypts unreadable file back to readable json file. + +These methods are public static and are exposed to all for now. + +Given below is an example on how the encryption and decryption behave at each step. + +** *Encryption*: + +Whenever the user enters a valid command, under the `LogicManager#execute()`, the data is firstly convert to JsonAdaptedObject and stored in a Json file. +Next, `FileCryptoUtil#encryption()` is called. A cipher will be initiated based on the specific SecretKey, + the algorithm used for encryption, and the transformation of the data. +The data in the json file will be read by bit and encrypted to unreadable format. The encrypted data is then stored in the encrypted file. + +[NOTE] +If the command cannot be executed successfully in `LogicManager#execute()`, then exception will be thrown before `FileCryptoUtil#encryption()`, + and the encryption will not be activated. + +** *Decryption* : + +When the user launches the application. `FileCryptoUtil#decryption()` will be called before the reading Json file into `StorageManager`. +A cipher will be initiated based on same SecretKey, algorithm and transformation used in the encryption of the data. +The data in the encrypted file is then read by bit and decrypted by the cipher into readable Json format. +The readable Json data is then stored in the Json file, which can be read by `JsonUtil#readJsonFile()` to JsonAdaptedObject. -_{Explain here how the data encryption feature will be implemented}_ +==== Design Considerations + +===== Aspect: Key management for cipher + +* **Alternative 1 (current choice):** Set a default key within the application. +** Pros: Easy to implement. +** Cons: Key cannot be changed, expose to possible brute force attack. +* **Alternative 2:** Set password requirement for the application and use password use the key. +** Pros: User can change the key regularly, which strengthen data security. +** Cons: Hard to implement to password feature. The password has to be further strengthen by PBKDF2 to enhance the complexity of the key. // end::dataencryption[] @@ -279,13 +347,15 @@ Refer to the guide <>. *Target user profile*: -* has a need to manage a significant number of contacts +* has a need to manage a large number of <> which arrives in batches +* has a need to manage a large number of suppliers +* has a need to draw insights from analysing transactions with suppliers and customers * prefer desktop apps over other types * can type fast * prefers typing over mouse input * is reasonably comfortable using CLI apps -*Value proposition*: manage contacts faster than a typical mouse/GUI driven app +*Value proposition*: manage an FMCG store faster than a typical mouse/GUI driven app [appendix] == User Stories @@ -295,35 +365,458 @@ Priorities: High (must have) - `* * \*`, Medium (nice to have) - `* \*`, Low (un [width="59%",cols="22%,<23%,<25%,<30%",options="header",] |======================================================================= |Priority |As a ... |I want to ... |So that I can... -|`* * *` |new user |see usage instructions |refer to instructions when I forget how to use the App +|`* * *` |new user |see usage instructions |refer to instructions when I forget how to use InventoryManager -|`* * *` |user |add a new person | +|`* * *` |user |add a new supplier | -|`* * *` |user |delete a person |remove entries that I no longer need +|`* * *` |user |add a new goods | -|`* * *` |user |find a person by name |locate details of persons without having to go through the entire list +|`* * *` |user |delete a supplier |remove entries that I no longer need -|`* *` |user |hide <> by default |minimize chance of someone else seeing them by accident +|`* * *` |user |find a supplier by goods sold |locate the relevant suppliers without having to go through the entire list -|`*` |user with many persons in the address book |sort persons by name |locate a person easily -|======================================================================= +|`* * *` |user |find a goods by name |locate the relevant goods without having to go through the entire list + +|`* * *` |user |see goods that are low in stock |know what to buy + +|`* * *` |user |see goods that are low in stock |buy more before running out + +|`* * *` |user |update inventory with the <> |avoid keeping track of the inventory personally + +|`* * *` |user |update prices of goods offered by suppliers |account for changes in supply agreement or prices + +|`* * *` |user |create a set purchase order automatically on a regular basis |simulate supply contracts + +|`* * *` |clumsy user |undo previous actions |fix mistakes in inputs or spelling + +|`* * *` |user |be notified of goods falling below a set quantity threshold |buy expected goods in advance -_{More to be added}_ +|`* * *` |user |be notified of goods that are above a set quantity threshold |avoid expiration of large number of goods + +|`* *` |user |hide transaction details by default |minimize chance of someone else seeing them by accident + +|`* *` |user |set expiry event for a batch of goods |account for expiration of goods + +|`* *` |user |change names of goods |avoid confusion when producers change the name of their products + +|`* *` |user |have a summary of the transactions throughout the day |determine performance of the day + +|`* *` |expanding user |see a performance tracker |find points of improvement in business activity + +|`*` |clumsy user |receive suggestion for the next words |avoid misspelling and be reminded of syntax + +|======================================================================= [appendix] == Use Cases -(For all use cases below, the *System* is the `AddressBook` and the *Actor* is the `user`, unless specified otherwise) +(For all use cases below, the *System* is the `InventoryManager` and the *Actor* is the `user`, unless specified otherwise) [discrete] -=== Use case: Delete person +:numbered!: +=== Use case: UC1 - listing all suppliers + +*MSS* + +1. User requests to list suppliers. +2. InventoryManager shows a list of suppliers. ++ +Use case ends. + +*Extensions* + +[none] +* 2a. The list is empty. ++ +[none] +** 2a1. InventoryManager shows a message to inform that there are no suppliers. ++ +Use case ends. + +=== Use case: UC2 - listing all goods + +*MSS* + +1. User requests to list goods. +2. InventoryManager shows a list of goods. ++ +Use case ends. + +*Extensions* + +[none] +* 2a. The list is empty. ++ +[none] +** 2a1. InventoryManager shows a message to inform that there are no goods. ++ +Use case ends. + +=== Use case: UC3 - adding a supplier + +*MSS* + +1. User requests to add a supplier with given details. +2. InventoryManager creates a supplier with the given details. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The given details of the supplier is incomplete. ++ +[none] +** 1a1. Inventory Manager shows an error message to indicate the incomplete details. ++ +Use case ends. + +[none] +* 1b. The given details of the supplier is invalid. ++ +[none] +** 1b1. Inventory Manager shows an error message to indicate the invalid details. ++ +Use case ends. + +[none] +* 1c. The given details contains a non-supported parameter e.g. age. ++ +[none] +** 1c1. Inventory Manager shows an error message to indicate the non-supported parameter. ++ +Use case ends. + +[none] +* 1d. The specified supplier already exists. ++ +[none] +** 1d1. Inventory Manager shows an error message to indicate that the supplier already exists. ++ +Use case ends. + +=== Use case: UC4 - deleting a supplier + +*MSS* + +1. User [.underline]#lists all suppliers (UC1).# +2. User selects a supplier from the list and requests to delete the supplier by the index shown on the list. +3. InventoryManager deletes the supplier. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The given index is invalid. ++ +[none] +** 2a1. InventoryManager shows an error message to indicate the invalid index. ++ +Use case ends. + +=== Use case: UC5 - deleting a good from supplier's list + +*MSS* + +1. User lists all suppliers (UC1). +2. User requests to delete a good from a supplier's list and give the good's name. +2. InventoryManager confirms the deletion. +3. InventoryManager deletes the good from the supplier's good list. ++ +Use case ends. + +*Extensions* + +1. The required good is not found. +** InventoryManager informs there is no such good found. ++ +Use case ends. + + +=== Use case: UC6 - editing a supplier + +*MSS* + +1. User lists all suppliers (UC1) +2. User requests to edit a supplier specified by the index and gives the new parameters +3. InventoryManager updates the details of the supplier. ++ +Use case ends. + +*Extensions* + +1. There is existing good in the list. +** The latest information of good will be updated. ++ +Use case ends. + +2. The given index is invalid. +** InventoryManager shows an error message to indicate the invalid index. ++ +Use case ends. + +3. The given details of the supplier is incomplete. +** Inventory Manager shows an error message to indicate the incomplete details. ++ +Use case ends. + +4. The given details of the supplier is invalid. +** Inventory Manager shows an error message to indicate the invalid details. ++ +Use case ends. + +5. The given details contains a non-supported parameter e.g. age. +** Inventory Manager shows an error message to indicate the non-supported parameter. ++ +Use case ends. + +6. The good is not found in the existing supplier's good list. +** Inventory Manager will include the good as a new good in the supplier's good list. ++ +Use case ends. + +=== Use case: UC7 - finding a supplier for a particular goods + +*MSS* + +1. User [.underline]#lists all goods (UC2).# +2. User requests to list the suppliers supplying the goods with a specified name. +3. InventoryManager shows a list of suppliers providing this goods. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The goods with the given name does not exist. ++ +[none] +** 2a1. InventoryManager shows an error message to indicate the goods does not exist. ++ +Use case ends. + +[none] +* 3a. The list is empty. ++ +[none] +** 3a1. InventoryManager informs the user that there are no suppliers providing this goods. ++ +Use case ends. + +=== Use case: UC8 - buying a particular goods *MSS* -1. User requests to list persons -2. AddressBook shows a list of persons -3. User requests to delete a specific person in the list -4. AddressBook deletes the person +1. User [.underline]#lists all the suppliers for a particular good (UC7).# +2. User requests to make a buy order for a quantity of the particular goods from a supplier. +3. InventoryManager adds the order and adds the quantity to the total number of that particular goods. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The goods with the given name does not exist. ++ +[none] +** 2a1. InventoryManager shows an error message to indicate the goods does not exist. ++ +Use case ends. + +[none] +* 2b. The supplier with the given name does not exist. ++ +[none] +** 2b1. InventoryManager shows an error message to indicate the supplier does not exist. ++ +Use case ends. + +[none] +* 2c. The quantity given is invalid. ++ +[none] +** 2c1. InventoryManager shows an error message to indicate the quantity is invalid. ++ +Use case ends. + +[none] +* 2d. One or more parameters are missing. ++ +[none] +** 2d1. InventoryManager shows an error message to indicate the missing parameters. ++ +Use case ends. + +=== Use case: UC9 - selling a particular goods + +*MSS* + +1. User [.underline]#lists all goods (UC2).# +2. User requests to make a selling order of a quantity of a particular goods. +3. InventoryManager adds the sell order and deducts the quantity in the selling order to the total number of the particular goods. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The goods with the given name does not exist. ++ +[none] +** 2a1. InventoryManager shows an error message to indicate the goods does not exist. ++ +Use case ends. + +[none] +* 2b. The quantity given is invalid. ++ +[none] +** 2b1. InventoryManager shows an error message to indicate the quantity is invalid. ++ +Use case ends. + +[none] +* 2c. The quantity given exceeds current amount in inventory. ++ +[none] +** 2c1. InventoryManager shows an error message to indicate insufficient quantity. ++ +Use case ends. + +[none] +* 2d. One or more parameters are missing. ++ +[none] +** 2d1. InventoryManager shows an error message to indicate the missing parameters. ++ +Use case ends. + +=== Use case: UC10 - finding goods low in quantity + +*MSS* + +1. User requests to display all goods that are below their respective minimum warning quantity. +2. InventoryManager lists all the goods that satisfy that condition. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** 1a1. InventoryManager informs the user that there are no goods that are low in quantity. ++ +Use case ends. + +=== Use case: UC11 - set lower threshold quantity of goods + +*MSS* + +1. User [.underline]#lists all goods (UC2).# +2. User sets a lower quantity threshold for a particular goods. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The quantity is invalid. +[none] +** 2a1. InventoryManager shows an error message to indicate the quantity is invalid. ++ +Use case ends. + +[none] +* 2b. The quantity is above the upper threshold, if it exists. +[none] +** 2b1. InventoryManager shows an error message to indicate the quantity is above the upper threshold. ++ +Use case ends. + +[none] +* 2c. The goods with the given name does not exist. +[none] +** 2c1. InventoryManager shows an error message to indicate the goods does not exist. ++ +Use case ends. + +=== Use case: UC12 - set upper threshold quantity of goods + +*MSS* + +1. User [.underline]#lists all goods (UC2).# +2. User sets an upper quantity threshold for a particular goods. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. The list is empty. ++ +[none] +** Use case ends. + +[none] +* 2a. The quantity is invalid. +[none] +** 2a1. InventoryManager shows an error message to indicate the quantity is invalid. ++ +Use case ends. + +[none] +* 2b. The quantity is below the lower threshold, if it exists. +[none] +** 2b1. InventoryManager shows an error message to indicate the quantity is below the lower threshold. ++ +Use case ends. + +[none] +* 2c. The goods with the given name does not exist. +[none] +** 2c1. InventoryManager shows an error message to indicate the goods does not exist. ++ +Use case ends. + +=== Use case: UC13 - listing all past transactions + +*MSS* + +1. User requests to list all past transactions. +2. InventoryManager lists all past transactions. + Use case ends. @@ -332,34 +825,102 @@ Use case ends. [none] * 2a. The list is empty. + +[none] +** 2a1. InventoryManager informs the user that there are no past transactions. ++ +Use case ends. + +=== Use case: UC14 - deleting all transaction history + +*MSS* + +1. User requests to delete transaction history. +2. InventoryManager requests for a confirmation to delete the transaction history. +3. User confirms the deletion. +4. InventoryManager deletes the transaction history. ++ +Use case ends. + +*Extensions* + +[none] +* 1a. There are no past transactions. ++ +[none] +** 1a1. InventoryManager informs the user that there are no past transactions. ++ +Use case ends. + +[none] +* 3a. The user cancels the deletion. ++ +[none] +** Use case ends. + +=== Use case: UC15 - undoing a command + +*MSS* + +1. User enters the undo command through the command line. +2. InventoryManager moves to the state before the latest modifying command e.g. add supplier. +3. InventoryManager shows a message indicating success. ++ +Use case ends. + +*Extensions* + +[none] +* 2a. InventoryManager is at the oldest recorded state and thus is unable to move to a previous state. ++ +[none] +** 2a1. InventoryManager informs the user that it is unable to undo from the oldest recorded state. ++ +Use case ends. + +=== Use case: UC16 - redoing a command + +*MSS* + +1. User enters the redo command through the command line. +2. InventoryManager moves to the state before the latest undo command. +3. InventoryManager shows a message indicating success. ++ Use case ends. -* 3a. The given index is invalid. +*Extensions* + +[none] +* 2a. InventoryManager is unable to move to the next state as it is already at the latest state. + [none] -** 3a1. AddressBook shows an error message. +** 2a1. InventoryManager informs the user that it is unable to redo from the latest state. + -Use case resumes at step 2. +Use case ends. -_{More to be added}_ +:numbered: [appendix] == Non Functional Requirements . Should work on any <> as long as it has Java `11` or above installed. -. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage. +. Should be able to hold up to 1000 suppliers and goods without a noticeable sluggishness in performance for typical usage. +. Should run without any internet connection. +. Should have a human-editable storage text file. +. Should not require a database. +. Should not require an installer to use. +. Should not exceed 100MB in application size. . A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse. -_{More to be added}_ - [appendix] == Glossary +[[fast-moving-consumer-goods]] Fast-moving consumer goods:: +Goods that are characterised by large inventory quantities, high turnover rate, numerous suppliers and short shelf-life. -[[mainstream-os]] Mainstream OS:: -Windows, Linux, Unix, OS-X +[[transaction-record]] Transaction record:: +A record of an event that results in change in the quantity of goods i.e. buying/selling. -[[private-contact-detail]] Private contact detail:: -A contact detail that is not meant to be shared with others +[[mainstream-os]] Mainstream OS:: +Windows, Linux, Unix, OS-X. [appendix] == Product Survey @@ -402,15 +963,15 @@ These instructions only provide a starting point for testers to work on; testers _{ more test cases ... }_ -=== Deleting a person +=== Deleting a supplier -. Deleting a person while all persons are listed +. Deleting a supplier while all suppliers are listed -.. Prerequisites: List all persons using the `list` command. Multiple persons in the list. +.. Prerequisites: List all suppliers using the `list` command. Multiple suppliers in the list. .. Test case: `delete 1` + 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. .. Test case: `delete 0` + - Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. + Expected: No supplier is deleted. Error details shown in the status message. Status bar remains the same. .. Other incorrect delete commands to try: `delete`, `delete x` (where x is larger than the list size) _{give more}_ + Expected: Similar to previous. diff --git a/docs/Documentation.adoc b/docs/Documentation.adoc deleted file mode 100644 index ad90ac87bda..00000000000 --- a/docs/Documentation.adoc +++ /dev/null @@ -1,123 +0,0 @@ -= AddressBook Level 3 - Documentation -:site-section: DeveloperGuide -:toc: -:toc-title: -:toc-placement: preamble -:sectnums: -:imagesDir: images -:stylesDir: stylesheets -:xrefstyle: full -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -:warning-caption: :warning: -endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3/tree/master - -== Introduction - -We use asciidoc for writing documentation. - -[NOTE] -We chose asciidoc over Markdown because asciidoc, although a bit more complex than Markdown, provides more flexibility in formatting. - -== Editing Documentation - -See <> to learn how to render `.adoc` files locally to preview the end result of your edits. -Alternatively, you can download the AsciiDoc plugin for IntelliJ, which allows you to preview the changes you have made to your `.adoc` files in real-time. - -== Editing Diagrams - -See <> to find out how to create and update the UML diagrams in the developer guide. - -== Publishing Documentation - -See <> to learn how to deploy GitHub Pages using Travis. - -== Converting Documentation to PDF format - -We use https://www.google.com/chrome/browser/desktop/[Google Chrome] for converting documentation to PDF format, as Chrome's PDF engine preserves hyperlinks used in webpages. - -Here are the steps to convert the project documentation files to PDF format. - -. Follow the instructions in <> to convert the AsciiDoc files in the `docs/` directory to HTML format. -. Go to your generated HTML files in the `build/docs` folder, right click on them and select `Open with` -> `Google Chrome`. -. Within Chrome, click on the `Print` option in Chrome's menu. -. Set the destination to `Save as PDF`, then click `Save` to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below. - -.Saving documentation as PDF files in Chrome -image::chrome_save_as_pdf.png[width="300"] - -[[Docs-SiteWideDocSettings]] -== Site-wide Documentation Settings - -The link:{repoURL}/build.gradle[`build.gradle`] file specifies some project-specific https://asciidoctor.org/docs/user-manual/#attributes[asciidoc attributes] which affects how all documentation files within this project are rendered. - -[TIP] -Attributes left unset in the `build.gradle` file will use their *default value*, if any. - -[cols="1,2a,1", options="header"] -.List of site-wide attributes -|=== -|Attribute name |Description |Default value - -|`site-name` -|The name of the website. -If set, the name will be displayed near the top of the page. -|_not set_ - -|`site-githuburl` -|URL to the site's repository on https://github.com[GitHub]. -Setting this will add a "View on GitHub" link in the navigation bar. -|_not set_ - -|`site-seedu` -|Define this attribute if the project is an official SE-EDU project. -This will render the SE-EDU navigation bar at the top of the page, and add some SE-EDU-specific navigation items. -|_not set_ - -|=== - -[[Docs-PerFileDocSettings]] -== Per-file Documentation Settings - -Each `.adoc` file may also specify some file-specific https://asciidoctor.org/docs/user-manual/#attributes[asciidoc attributes] which affects how the file is rendered. - -Asciidoctor's https://asciidoctor.org/docs/user-manual/#builtin-attributes[built-in attributes] may be specified and used as well. - -[TIP] -Attributes left unset in `.adoc` files will use their *default value*, if any. - -[cols="1,2a,1", options="header"] -.List of per-file attributes, excluding Asciidoctor's built-in attributes -|=== -|Attribute name |Description |Default value - -|`site-section` -|Site section that the document belongs to. -This will cause the associated item in the navigation bar to be highlighted. -One of: `UserGuide`, `DeveloperGuide`, ``LearningOutcomes``{asterisk}, `AboutUs`, `ContactUs` - -_{asterisk} Official SE-EDU projects only_ -|_not set_ - -|`no-site-header` -|Set this attribute to remove the site navigation bar. -|_not set_ - -|=== - -== Site Template - -The files in link:{repoURL}/docs/stylesheets[`docs/stylesheets`] are the https://developer.mozilla.org/en-US/docs/Web/CSS[CSS stylesheets] of the site. -You can modify them to change some properties of the site's design. - -The files in link:{repoURL}/docs/templates[`docs/templates`] controls the rendering of `.adoc` files into HTML5. -These template files are written in a mixture of https://www.ruby-lang.org[Ruby] and http://slim-lang.com[Slim]. - -[WARNING] -==== -Modifying the template files in link:{repoURL}/docs/templates[`docs/templates`] requires some knowledge and experience with Ruby and Asciidoctor's API. -You should only modify them if you need greater control over the site's layout than what stylesheets can provide. -The SE-EDU team does not provide support for modified template files. -==== diff --git a/docs/LearningOutcomes.adoc b/docs/LearningOutcomes.adoc old mode 100644 new mode 100755 diff --git a/docs/SettingUp.adoc b/docs/SettingUp.adoc deleted file mode 100644 index c0659782fab..00000000000 --- a/docs/SettingUp.adoc +++ /dev/null @@ -1,84 +0,0 @@ -= AddressBook Level 3 - Setting Up -:site-section: DeveloperGuide -:toc: -:toc-title: -:toc-placement: preamble -:sectnums: -:imagesDir: images -:stylesDir: stylesheets -:xrefstyle: full -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -:warning-caption: :warning: -endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3/tree/master - -== Prerequisites - -. *JDK `11`* or above -. *IntelliJ* IDE -+ -[NOTE] -IntelliJ by default has Gradle and JavaFx plugins installed. + -Do not disable them. If you have disabled them, go to `File` > `Settings` > `Plugins` to re-enable them. - -== Setting up the project in your computer - -. Fork this repo, and clone the fork to your computer -. Open IntelliJ (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first) -. Set up the correct JDK version for Gradle -.. Click `Configure` > `Project Defaults` > `Project Structure` -.. Click `New...` and find the directory of the JDK -. Click `Import Project` -. Locate the `build.gradle` file and select it. Click `OK` -. Click `Open as Project` -. Click `OK` to accept the default settings. - -== Verifying the setup - -. Run the `seedu.address.Main` and try a few commands -. <> to ensure they all pass. - -== Configurations to do before writing code - -=== Configuring the coding style - -This project follows https://github.com/oss-generic/process/blob/master/docs/CodingStandards.adoc[oss-generic coding standards]. IntelliJ's default style is mostly compliant with ours but it uses a different import order from ours. To rectify, - -. Go to `File` > `Settings...` (Windows/Linux), or `IntelliJ IDEA` > `Preferences...` (macOS) -. Select `Editor` > `Code Style` > `Java` -. Click on the `Imports` tab to set the order - -* For `Class count to use import with '\*'` and `Names count to use static import with '*'`: Set to `999` to prevent IntelliJ from contracting the import statements -* For `Import Layout`: The order is `import static all other imports`, `import java.\*`, `import javax.*`, `import org.\*`, `import com.*`, `import all other imports`. Add a `` between each `import` - -Optionally, you can follow the <> document to configure Intellij to check style-compliance as you write code. - -=== Updating documentation to match your fork - -After forking the repo, the documentation will still have the SE-EDU branding and refer to the `se-edu/addressbook-level3` repo. - -If you plan to develop this fork as a separate product (i.e. instead of contributing to `se-edu/addressbook-level3`), you should do the following: - -. Configure the <> in link:{repoURL}/build.gradle[`build.gradle`], such as the `site-name`, to suit your own project. - -. Replace the URL in the attribute `repoURL` in link:{repoURL}/docs/DeveloperGuide.adoc[`DeveloperGuide.adoc`] and link:{repoURL}/docs/UserGuide.adoc[`UserGuide.adoc`] with the URL of your fork. - -=== Setting up CI - -Set up Travis to perform Continuous Integration (CI) for your fork. See <> to learn how to set it up. - -After setting up Travis, you can optionally set up coverage reporting for your team fork (see <>). - -[NOTE] -Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your personal fork. - -Optionally, you can set up AppVeyor as a second CI (see <>). - -[NOTE] -Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based) - -=== Getting started with coding - -When you are ready to start coding, we recommend that you get some sense of the overall design by reading about <>. diff --git a/docs/Testing.adoc b/docs/Testing.adoc deleted file mode 100644 index 5767b92912c..00000000000 --- a/docs/Testing.adoc +++ /dev/null @@ -1,52 +0,0 @@ -= AddressBook Level 3 - Testing -:site-section: DeveloperGuide -:toc: -:toc-title: -:toc-placement: preamble -:sectnums: -:imagesDir: images -:stylesDir: stylesheets -:xrefstyle: full -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -:warning-caption: :warning: -endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3/tree/master - -== Running Tests - -There are two ways to run tests. - -*Method 1: Using IntelliJ JUnit test runner* - -* To run all tests, right-click on the `src/test/java` folder and choose `Run 'All Tests'` -* To run a subset of tests, you can right-click on a test package, test class, or a test and choose `Run 'ABC'` - -*Method 2: Using Gradle* - -* Open a console and run the command `gradlew clean test` (Mac/Linux: `./gradlew clean test`) - -[NOTE] -See <> for more info on how to run tests using Gradle. - -== Types of tests - -We have three types of tests: - -. _Unit tests_ targeting the lowest level methods/classes. + -e.g. `seedu.address.commons.StringUtilTest` -. _Integration tests_ that are checking the integration of multiple code units (those code units are assumed to be working). + -e.g. `seedu.address.storage.StorageManagerTest` -. Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together. + -e.g. `seedu.address.logic.LogicManagerTest` - - -== Troubleshooting Testing -**Problem: Keyboard and mouse movements are not simulated on macOS Mojave, resulting in GUI Tests failure.** - -* Reason: From macOS Mojave onwards, applications without `Accessibility` permission cannot simulate certain keyboard and mouse movements. -* Solution: Open `System Preferences`, click `Security and Privacy` -> `Privacy` -> `Accessibility`, and check the box beside `Intellij IDEA`. - -.`Accessibility` permission is granted to `IntelliJ IDEA` -image::testfx-idea-accessibility-permissions.png[width="600"] diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc old mode 100644 new mode 100755 index 4e5d297a19f..bdb1f042f6e --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -1,4 +1,4 @@ -= AddressBook Level 3 - User Guide += InventoryManager - User Guide :site-section: UserGuide :toc: :toc-title: @@ -12,19 +12,19 @@ ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: endif::[] -:repoURL: https://github.com/se-edu/addressbook-level3 +:repoURL: https://github.com/AY1920S2-CS2103-W14-2/main -By: `Team SE-EDU` Since: `Jun 2016` Licence: `MIT` +By: `AY1920S2-CS2103-W14-2`      Since: `Feb 2020`      Licence: `MIT` == Introduction -AddressBook Level 3 (AB3) is for those who *prefer to use a desktop app for managing contacts*. More importantly, AB3 is *optimized for those who prefer to work with a Command Line Interface* (CLI) while still having the benefits of a Graphical User Interface (GUI). If you can type fast, AB3 can get your contact management tasks done faster than traditional GUI apps. Interested? Jump to the <> to get started. Enjoy! +InventoryManager is for those who *prefer to use a desktop app for managing their inventory*. More importantly, InventoryManager is *optimized for those who prefer to work with a Command Line Interface* (CLI) while still having the benefits of a Graphical User Interface (GUI). If you can type fast, InventoryManager can get your inventory management tasks done faster than traditional GUI apps. Interested? Jump to the <> to get started. Enjoy! == Quick Start . Ensure you have Java `11` or above installed in your Computer. -. Download the latest `addressbook.jar` link:{repoURL}/releases[here]. -. Copy the file to the folder you want to use as the home folder for your Address Book. +. Download the latest `inventorymanager.jar` link:{repoURL}/releases[here]. +. Copy the file to the folder you want to use as the home folder for your InventoryManager. . Double-click the file to start the app. The GUI should appear in a few seconds. + image::Ui.png[width="790"] @@ -33,9 +33,9 @@ image::Ui.png[width="790"] e.g. typing *`help`* and pressing kbd:[Enter] will open the help window. . Some example commands you can try: -* *`list`* : lists all contacts -* **`add`**`n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` : adds a contact named `John Doe` to the Address Book. -* **`delete`**`3` : deletes the 3rd contact shown in the current list +* *`list-s`* : lists all suppliers +* **`add`**`n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 gp/apple 4.50` : adds a supplier named `John Doe` selling apples at 4.50 each to the InventoryManager. +* **`delete-s 3`** : deletes the 3rd supplier shown in the current list * *`exit`* : exits the app . Refer to <> for details of each command. @@ -47,57 +47,60 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window. *Command Format* * Words in `UPPER_CASE` are the parameters to be supplied by the user e.g. in `add n/NAME`, `NAME` is a parameter which can be used as `add n/John Doe`. -* Items in square brackets are optional e.g `n/NAME [t/TAG]` can be used as `n/John Doe t/friend` or as `n/John Doe`. -* Items with `…`​ after them can be used multiple times including zero times e.g. `[t/TAG]...` can be used as `{nbsp}` (i.e. 0 times), `t/friend`, `t/friend t/family` etc. +* Items in square brackets are optional e.g `n/NAME [gp/GOOD PRICE]` can be used as `n/John Doe gp/apple 4.50` or as `n/John Doe`. +* Items with `…`​ after them can be used multiple times including zero times e.g. `[gp/GOOD PRICE]...` can be used as `{nbsp}` (i.e. 0 times), `gp/apple 4.50`, `gp/orange 2.00 gp/pear 5.00` etc. * Parameters can be in any order e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable. +* All dates follow the format `yyyy-MM-dd` ==== === Viewing help : `help` Format: `help` -=== Adding a person: `add` +=== Adding a supplier: `add` -Adds a person to the address book + -Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` +Adds a supplier to the inventory manager + +Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [gp/GOOD PRICE]...` [TIP] -A person can have any number of tags (including 0) +A supplier can have any number of good-price pairs (including 0) Examples: * `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` -* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 t/criminal` +* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 gp/drugs 500` -=== Listing all persons : `list` +=== Listing all suppliers : `list-s` -Shows a list of all persons in the address book. + -Format: `list` +Shows a list of all suppliers in the inventory manager. + +Format: `list-s` -=== Editing a person : `edit` +=== Editing a supplier : `edit-s` -Edits an existing person in the address book. + -Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]...` +Edits an existing supplier in the inventory manager. + +Format: `edit-s INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [gp/GOOD PRICE]...` **** -* Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index *must be a positive integer* 1, 2, 3, ... +* Edits the supplier at the specified `INDEX`. The index refers to the index number shown in the displayed supplier list. The index *must be a positive integer* 1, 2, 3, ... * At least one of the optional fields must be provided. * Existing values will be updated to the input values. -* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative. -* You can remove all the person's tags by typing `t/` without specifying any tags after it. +* If the entered good-price pair is not in the existing supplier's list, the entered good price pair will be stored in the supplier's list as a new good price pair. +* When editing good-price pairs, the existing good-price pairs of the person will be removed i.e adding of good-price pairs is not cumulative. +[TIP] +You can add any number of good-price pairs to the existing suppliers at one time. **** Examples: -* `edit 1 p/91234567 e/johndoe@example.com` + -Edits the phone number and email address of the 1st person to be `91234567` and `johndoe@example.com` respectively. -* `edit 2 n/Betsy Crower t/` + -Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags. +* `edit-s 1 p/91234567 e/johndoe@example.com` + +Edits the phone number and email address of the 1st supplier to be `91234567` and `johndoe@example.com` respectively. +* `edit-s 2 gp/apple 5 gp/banana 10` + +The existing second supplier only has apple priced at 1 dollar. Hence, this command will edit the price of apple to 5 dollar and add the good price pair of banana into the supplier's good list. -=== Locating persons by name: `find` +=== Locating suppliers by name: `find-s` -Finds persons whose names contain any of the given keywords. + -Format: `find KEYWORD [MORE_KEYWORDS]` +Finds suppliers whose names contain any of the given keywords. + +Format: `find-s KEYWORD [MORE_KEYWORDS]` **** * The search is case insensitive. e.g `hans` will match `Hans` @@ -109,37 +112,141 @@ Format: `find KEYWORD [MORE_KEYWORDS]` Examples: -* `find John` + +* `find-s John` + Returns `john` and `John Doe` -* `find Betsy Tim John` + -Returns any person having names `Betsy`, `Tim`, or `John` +* `find-s Betsy Tim John` + +Returns any supplier having names `Betsy`, `Tim`, or `John` // tag::delete[] -=== Deleting a person : `delete` +=== Deleting a supplier : `delete-s` -Deletes the specified person from the address book. + -Format: `delete INDEX` +Deletes the specified supplier from the address book. + +Format: `delete-s INDEX [g/GOOD NAME]` **** -* Deletes the person at the specified `INDEX`. -* The index refers to the index number shown in the displayed person list. +* The optional field [g/GOOD NAME] can be empty. +* If the optional field is empty, the command will delete the supplier at the specified `INDEX`. +* If the optional field is not empty, the command will delete the good listed in the supplier's list for supplier with the specified `INDEX`. +* The index refers to the index number shown in the displayed supplier list. * The index *must be a positive integer* 1, 2, 3, ... **** Examples: -* `list` + -`delete 2` + -Deletes the 2nd person in the address book. -* `find Betsy` + -`delete 1` + -Deletes the 1st person in the results of the `find` command. +* `list-s` + +`delete-s 2` + +Deletes the 2nd supplier in the inventory manager. +* `find-s Betsy` + +`delete-s 1 g/banana` + +Deletes the good price pair of good 'banana' in the good list of the first supplier who appeared in the suppliers' list after filtering with the name "Betsy". // end::delete[] -=== Clearing all entries : `clear` +=== Clearing all supplier entries : `clear-s` + +Clears all supplier entries from the address book. + +Format: `clear-s` + +=== Buying goods from supplier: `buy` + +Buys a batch of goods from a supplier in the contact list who stocks that product. The inventory manager cannot buy products in the following cases: + +. The supplier has not been entered in the supplier list +. The supplier has not been registered to the good, as indicated by the "offers" section of each supplier + +Format: `buy n/SUPPLIER_NAME g/GOOD_NAME q/QUANTITY` + +Example: + +* `buy n/Cold Storage g/Apple q/4` + +Buys 4 apples from Supplier named Cold Storage. + +[TIP] +If the good does not exist in the inventory, a new entry for that good will be created. + +[CAUTION] +Name of supplier and good name is case sensitive. + +[CAUTION] +The maximum quantity of any good in the inventory is 999,999. Users are not allowed to buy quantities of goods that would cause that limit to be exceeded. + +[NOTE] +As of v1.3, the buy command does not yet interact with the transaction history. + +=== Selling goods: `sell` + +Sells a particular goods from the inventory. + +The inventory manager cannot sell products in the following cases: + +. The good being sold does not exist in the inventory +. The quantity being sold is larger than the amount existing in the inventory + +Format: `sell g/GOOD_NAME q/QUANTITY p/PRICE` + +Example: + +* `sell g/Apple q/4 p/3.5` + +Sells 4 apples at $3.50 each. + +[TIP] +The selling price can be specified to the nearest cent, or 2 decimal places maximum. + +[TIP] +When the quantity in inventory reaches 0, the name of the good is not deleted for future reference or restocking. +This entry can be deleted using the `delete-g` command. + +[CAUTION] +Name of supplier and good name is case sensitive. + +[NOTE] +As of v1.3, the sell command does not yet interact with the transaction history. +The selling price will be used to perform profit calculations in v1.4. + +=== Delete good entry in inventory: `delete-g` +Deletes an entry for a good in the inventory. +The good to be deleted is at the displayed index shown in the middle inventory panel. +All of the good's quantity will be removed in the process. + +Format: `delete-g INDEX` + +Example: +* `delete-g 3` +The good entry at displayed index 3 will be removed, provided there is an entry at index 3. + + +=== Sourcing suppliers for a particular goods: `source` + +Displays all the suppliers selling the specified goods, sorted in increasing price. + +Format: `source g/GOOD_NAME` + +=== Setting minimum quantity for goods: `warn` + +Sets the minimum quantity threshold for a certain good. + +When the quantity of the good is below the threshold, the quantity of the good will be mark with red color background +and rank higher up in the inventory list. + +All goods under their threshold quantity will be shown before all goods above their threshold quantity. + +Format: `warn INDEX q/MIN_QUANTITY` + +Example: + +* `warn 1 q/100` + +This sets the minimum quantity threshold for good at index 1 with an quantity of 100. + +[NOTE] +When a new good is added into the inventory, its minimum quantity threshold is set at 0. + +=== Undoing a recently executed command: `undo` + +Removes changes from a recently executed command. Commands that only affect display e.g. find and list, and undo commands, will be ignored and the next command in line will be undone. + +Format: `undo` + +=== Redoing a previously undone command: `redo` -Clears all entries from the address book. + -Format: `clear` +Redoes changes undone by the most recent undo command. + +Format: `redo` === Exiting the program : `exit` @@ -148,30 +255,45 @@ Format: `exit` === Saving the data -Address book data are saved in the hard disk automatically after any command that changes the data. + +Inventory manager data are saved in the hard disk automatically after any command that changes the data. + There is no need to save manually. // tag::dataencryption[] === Encrypting data files `[coming in v2.0]` -_{explain how the user can enable/disable data encryption}_ +For security concerns, all data will be encrypted by default. // end::dataencryption[] == FAQ *Q*: How do I transfer my data to another Computer? + -*A*: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous Address Book folder. +*A*: Install the app in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous InventoryManager folder. == Command Summary -* *Add* `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]...` + -e.g. `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 t/friend t/colleague` -* *Clear* : `clear` -* *Delete* : `delete INDEX` + -e.g. `delete 3` -* *Edit* : `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]...` + -e.g. `edit 2 n/James Lee e/jameslee@example.com` -* *Find* : `find KEYWORD [MORE_KEYWORDS]` + -e.g. `find James Jake` -* *List* : `list` +* *Add supplier* `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [gp/GOOD PRICE]...` + +e.g. `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 gp/pen 1.00` +* *List supplier* : `list-s` +* *Clear suppliers* : `clear-s` +* *Delete supplier* : `delete-s INDEX [g/GOOD NAME]` + +e.g. `delete-s 3 g/apple` +* *Edit supplier* : `edit-s INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [gp/GOOD PRICE]...` + +e.g. `edit-s 2 n/James Lee e/jameslee@example.com` gp/apple 10 +* *Find supplier* : `find-s KEYWORD [MORE_KEYWORDS]` + +e.g. `find-s James Jake` +* *List goods*: `list-i` +* *List supplier for a goods*: `source` +* *Buy goods*: `buy n/SUPPLIER_NAME g/GOOD_NAME q/QUANTITY x/EXPIRY_DATE d/TRANSACTION_DATE` + +e.g. `buy n/Dave g/apple q/4 x/2003-08-01 d/2002-07-03` +* *Sell goods*: `sell g/GOOD_NAME q/QUANTITY d/TRANSACTION_DATE` + +e.g. `sell g/apple q/4 d/2030-01-05` +* *List goods low in quantity*: `list-l` +* *Set minimum quantity for goods*: `set g/GOOD_NAME q/MIN_QUANTITY` +* *List expiring goods*: `list-e` +* *List transaction history*: `list-t` +* *Clear transaction history*: `clear-t` +* *Edit buy order*: `edit-bo INDEX [n/SUPPLIER_NAME] [g/GOOD_NAME] [q/QUANTITY] [d/TRANSACTION_DATE] [x/EXPIRY_DATE]` +* *Edit sell order*: `edit-so INDEX [g/GOOD_NAME][q/QUANTITY][d/TRANSACTION_DATE]` +* *Undo*: `undo` +* *Redo*: `redo` * *Help* : `help` diff --git a/docs/UsingAppVeyor.adoc b/docs/UsingAppVeyor.adoc deleted file mode 100644 index 12a7a89ac68..00000000000 --- a/docs/UsingAppVeyor.adoc +++ /dev/null @@ -1,94 +0,0 @@ -= AppVeyor -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -ifdef::env-github[] -:note-caption: :information_source: -endif::[] - -[NOTE] -==== -This document was originally written for _AddressBook Level 4_ and hence its screenshots refer to `addressbook-level4`. -For use with _AddressBook Level 3_, wherever `addressbook-level4` is used in the screenshots, you should use *`addressbook-level3`*. -==== - -https://www.appveyor.com/[AppVeyor] is a _Continuous Integration_ platform for GitHub projects. It runs its builds on Windows virtual machines. - -AppVeyor can run the project's tests automatically whenever new code is pushed to the repo. This ensures that existing functionality and features have not been broken on Windows by the changes. - -The current AppVeyor setup runs `gradlew.bat test` whenever someone pushes code to the repo. - -If you would like to customize your AppVeyor build further, you can learn more about AppVeyor from the https://www.appveyor.com/docs/[AppVeyor Documentation]. - -== Setting up AppVeyor - -. Fork the repo to your own organization. -. Go to https://ci.appveyor.com/, and under `Login`, click on `GitHub` to login with your GitHub account. Enter your GitHub account details if needed. -+ -image:appveyor/login.png[Click on GitHub in the login page] -+ -. After logging in, you will be brought to your projects dashboard. Click on `NEW PROJECT`. -+ -image:appveyor/add-project-1.png[Click on "NEW PROJECT" in the projects dashboard] -+ -. You will be brought to the `Select repository` page. Select `GitHub`. -* On your first usage of AppVeyor, you will need to give AppVeyor authorization to your GitHub account. Click on `Authorize GitHub`. -+ -image:appveyor/add-project-2.png[Click on Authorize GitHub] -+ -* This will bring you to a GitHub page that manages the access of third-party applications to your repositories. -+ -Depending on whether you are the owner of the repository, you can either -grant access: -+ -image:grant_access.png[Grant Access] -+ -Or request access: -+ -image:request_access.png[Request Access] -+ -. AppVeyor will then list the repositories you have access to in your GitHub account. Find the repository you want to set AppVeyor up on, and then click `ADD`. -+ -image:appveyor/add-project-3.png[Click "Add" on the repository you want to set AppVeyor up on] -+ -. AppVeyor will then be activated on that repository. To see the CI in action, push a commit to any branch! -* Go to the repository and see the pushed commit. There should be an icon which will link you to the AppVeyor build: -+ -image:appveyor/ci-pending.png[Commit build] -+ -* As the build is run on a remote machine, we can only examine the logs it produces: -+ -image:appveyor/ci-log.png[AppVeyor build] -+ -. Update the link to the "build status" badge at the top of `README.adoc` to point to the AppVeyor build status of your own repo. -* To find your build status badge URL, first go to your project settings by clicking on the "Settings" icon: -+ -image:appveyor/project-settings-1.png[Click on project settings] -+ -* Then go to the `Badges` section of your project settings by clicking on it: -+ -image:appveyor/project-settings-2.png[Click on "Badges"] -+ -* As AppVeyor does not provide asciidoc code for the badge, we will have to create our own. Start by copying the markdown code provided: -+ -image:appveyor/project-settings-3.png[Copy the markdown code] -+ -The markdown code should be in this format: -+ ----- -[![Build status]()]() ----- -+ -Convert it to the asciidoc format as follows: -+ ----- -[image:[Build status]] ----- -+ -The asciidoc code should look similar to: -+ ----- -https://ci.appveyor.com/project/damithc/addressbook-level3[image:https://ci.appveyor.com/api/projects/status/3boko2x2vr5cc3w2?svg=true[Build status]] ----- -+ -Copy and paste the asciidoc code to your `README.adoc` file. diff --git a/docs/UsingCheckstyle.adoc b/docs/UsingCheckstyle.adoc deleted file mode 100644 index a12ab09cc9c..00000000000 --- a/docs/UsingCheckstyle.adoc +++ /dev/null @@ -1,48 +0,0 @@ -= Using Checkstyle-IDEA -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -:experimental: -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -endif::[] - -[NOTE] -==== -This document was originally written for _AddressBook Level 4_ and hence its screenshots refer to `addressbook-level4`. -For use with _AddressBook Level 3_, wherever `addressbook-level4` is used in the screenshots, you should use *`addressbook-level3`*. -==== - -== Configuring Checkstyle-IDEA - -. Install the Checkstyle-IDEA plugin by going to `File` > `Settings` (Windows/Linux), or `IntelliJ IDEA` > `Preferences...` (macOS). + -Select `Plugins`, press `Browse Repository`, and find the plugin. + -Restart the IDE to complete the installation. -. Click `File` > `Settings...` > `Other Settings` > `Checkstyle` -. Set `Scan Scope` to `Only Java sources (including tests)`, so that the plugin will run checkstyle for our test source codes as well -. Ensure that the `Checkstyle version` is set to `8.1`. This is the same version that we are using inside Gradle, so that you won't get any errors due to version incompatibility - * If `Checkstyle version` is not set to `8.1`, set it to version `8.1` and click `Apply` -+ -image::checkstyle-idea-scan-scope.png[width="500"] -. Click the plus sign under `Configuration File` -. Enter an arbitrary description e.g. addressbook -. Select `Use a local Checkstyle file` -. Use the checkstyle configuration file found at `config/checkstyle/checkstyle.xml` -. Click `Next` > `Finish` -. Mark `Active` for the newly imported check configuration -+ -image::checkstyle-idea-configuration.png[width="700"] -. Click `OK` - -== Troubleshooting Checkstyle-IDEA - -**Problem: When importing `checkstyle.xml`, Checkstyle-IDEA plugin complains that `The Checkstyle rules file could not be parsed. ... The file has been blacklisted for 60s.`** - -* Reason: `checkstyle.xml` is written for a particular version, but the plugin was not configured to the correct version. -* Solution: Ensure that you have selected the correct `Checkstyle version` that matches the version in `build.gradle` and have clicked `Apply`, as `checkstyle.xml` is written for Gradle's checkstyle. - -**Problem: After setting up `checkstyle.xml`, Checkstyle-IDEA plugin does not seem to highlight the errors / real-time scanning seems broken.** - -* Reason: The plugin may not immediately run after setting it up. -* Solution: Restart the IDE. diff --git a/docs/UsingCoveralls.adoc b/docs/UsingCoveralls.adoc deleted file mode 100644 index 5191e47316c..00000000000 --- a/docs/UsingCoveralls.adoc +++ /dev/null @@ -1,63 +0,0 @@ -= Using Coveralls -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -ifdef::env-github[] -:note-caption: :information_source: -endif::[] - -[NOTE] -==== -This document was originally written for _AddressBook Level 4_ and hence its screenshots refer to `addressbook-level4`. -For use with _AddressBook Level 3_, wherever `addressbook-level4` is used in the screenshots, you should use *`addressbook-level3`*. -==== - -https://coveralls.io/[Coveralls] is a web service that tracks code coverage over time for GitHub projects. -Coveralls requires Travis CI to be set up beforehand as Travis sends the coverage report from the latest build to Coveralls. -If you have not set up Travis CI, see <>. Currently, Coveralls supports Travis CI but not AppVeyor. - -== Setting up Coveralls - -. Go to https://coveralls.io/ and click `SIGN IN`. Then click `GITHUB SIGN IN` and enter your GitHub account details if needed. -+ -. After logging in, you will be brought to the `Your Repositories` page. On the site's navigation bar, click https://coveralls.io/repos/new[ADD REPOS]. -+ -. Find the switch for the forked repository. -* If the organization is not shown, click `GITHUB SETTINGS` as shown below: -+ -image:coveralls/github_settings.png[GitHub settings] -+ -This should bring you to a GitHub page that manages the access of third-party applications. Depending on whether you are the owner of the repository, you can either grant access -+ -image:grant_access.png[Grant Access] -+ -or request access -+ -image:request_access.png[Request Access] -+ -to Coveralls so that it can access your repository. -* If your repository cannot be found, click `SYNC REPOS`. -+ -image:coveralls/sync_repos.png[Sync repos] -+ -. Activate the switch. -+ -image:coveralls/flick_repository_switch.png[Activate the switch] -+ -. Update the link of the `Coverage Status` badge at the top of your <> to point to that of your own repo by replacing the outlined areas with `your-org-name/your-repo-name`. -+ -image:coveralls/coverage_asciidoc_code.png[Coverage Status Badge] -+ -. You can now see the coverage report for your project after each Travis build by clicking on the `Coverage Status` badge. -+ -image:coveralls/coverage_report.png[Coverage Report Summary] - -== Disabling Coveralls Automatic Comments on Pull Requests - -Coveralls automatically comments on the coverage status of the pull requests in GitHub. If it's a hindrance, you can disable it in the settings of your project in Coveralls: - -. Click `Settings`. -+ -. Uncheck the `LEAVE COMMENTS?` checkbox. Then click `SAVE CHANGES`. -+ -image:coveralls/disable_comments.png[Disable comments, width = 942] diff --git a/docs/UsingGradle.adoc b/docs/UsingGradle.adoc deleted file mode 100644 index cca9c6d1d12..00000000000 --- a/docs/UsingGradle.adoc +++ /dev/null @@ -1,99 +0,0 @@ -= Using Gradle -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -:experimental: -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -endif::[] - -https://gradle.org/[Gradle] is a build automation tool. It can automate build-related tasks such as - -* Running tests -* Managing library dependencies -* Analyzing code for style compliance - -The gradle configuration for this project is defined in the _build script_ link:../build.gradle[`build.gradle`]. - -[NOTE] -To learn more about gradle build scripts, refer https://docs.gradle.org/current/userguide/tutorial_using_tasks.html[Build Scripts Basics]. - -== Running Gradle Commands - -To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: - -* On Windows: `gradlew ...` e.g. `gradlew clean test` -* On Mac/Linux: `./gradlew ...` e.g. -`./gradlew clean test` - -[NOTE] -If you do not specify any tasks, Gradlew will run the default tasks `clean` `test` `coverage` - -== Cleaning the Project - -* *`clean`* + -Deletes the files created during the previous build tasks (e.g. files in the `build` folder). e.g. `./gradlew clean` - -[TIP] -*`clean` to force Gradle to execute a task*: + -When running a Gradle task, Gradle will try to figure out if the task needs running at all. If Gradle determines that the output of the task will be same as the previous time, it will not run the task. For example, it will not build the JAR file again if the relevant source files have not changed since the last time the JAR file was built. If we want to force Gradle to run a task, we can combine that task with `clean`. Once the build files have been `clean` ed, Gradle has no way to determine if the output will be same as before, so it will be forced to execute the task. - -== Creating the JAR file - -* *`shadowJar`* + -Creates the `addressbook.jar` file in the `build/jar` folder, _if the current file is outdated_. + -e.g. `./gradlew shadowJar` - -**** -To force Gradle to create the JAR file even if the current one is up-to-date, you can '`clean`' first. + -e.g. `./gradlew clean shadowJar` -**** - -[NOTE] -*Why do we create a fat JAR?* If we package only our own class files into the JAR file, it will not work properly unless the user has all the other JAR files (i.e. third party libraries) our classes depend on, which is rather inconvenient. Therefore, we package all dependencies into a single JAR files, creating what is also known as a _fat_ JAR file. To create a fat JAR file, we use the Gradle plugin https://github.com/johnrengelman/shadow[shadow jar]. - -== Rendering AsciiDoc files - -* **`asciidoctor`** + -Converts AsciiDoc files in `docs` to HTML format. Generated HTML files can be found in `build/docs`. -* **`deployOfflineDocs`** + -Updates the offline user guide, and its associated files, used by the Help window in the application. Deployed HTML files and images can be found in `src/main/resources/docs`. - -== Running the application - -* *`run`* + -Builds and runs the application. -* *`runShadow`* + -Builds the application as a fat JAR, and then runs it. - -== Running code style checks - -* **`checkstyleMain`** + -Runs the code style check for the main code base -* **`checkstyleTest`** + -Runs the code style check for the test code base - -The set of code style rules implemented can be found in `config/checkstyle/checkstyle.xml`. To enable _exceptions_ to code styles, add in the comment `//CODESTYLE.OFF: RuleName` at the start of the section and `//CODESTYLE.ON: RuleName` at the end of the section. - -== Running Tests - -* **`test`** + -Runs all tests. - -Here are some examples: - -* `./gradlew test` -- Runs all tests -* `./gradlew clean test` -- Cleans the project and runs tests - -== Updating Dependencies - -There is no need to run these Gradle tasks manually as they are called automatically by other relevant Gradle tasks. - -* **`compileJava`** + -Checks whether the project has the required dependencies to compile and run the main program, and download any missing dependencies before compiling the classes. + -See `build.gradle` -> -`allprojects` -> `dependencies` -> `compile` for the list of dependencies required. -* **`compileTestJava`** + -Checks whether the project has the required dependencies to perform testing, and download any missing dependencies before compiling the test classes. + -See `build.gradle` -> `allprojects` -> `dependencies` -> `testCompile` for the list of dependencies required. diff --git a/docs/UsingNetlify.adoc b/docs/UsingNetlify.adoc deleted file mode 100644 index 2e108c936a3..00000000000 --- a/docs/UsingNetlify.adoc +++ /dev/null @@ -1,59 +0,0 @@ -= Using Netlify -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -ifdef::env-github[] -:note-caption: :information_source: -endif::[] - -[NOTE] -==== -This document was originally written for _AddressBook Level 4_ and hence its screenshots refer to `addressbook-level4`. -For use with _AddressBook Level 3_, wherever `addressbook-level4` is used in the screenshots, you should use *`addressbook-level3`*. -==== - -https://www.netlify.com/[Netlify] is an automated hosting platform for deploying static websites. With the aid of build tools such as Gradle, Netlify provides a smoother experience for previewing documentation. This can be done by using Netlify's https://www.netlify.com/blog/2016/07/20/introducing-deploy-previews-in-netlify/[Deploy Previews] feature, which shows a preview of the updated documentation whenever a pull request is made. - -== Setting up Netlify -. Fork the repository to your own organization. -+ -. Go to https://www.netlify.com/ and click `Sign Up`. Next, click `GITHUB SIGN IN`, enter your GitHub account details and authorize netlify. -+ -. After logging in, click `New site from Git`. -+ -. You will then be brought to the setup page. Click `GitHub` to link your repository to Netlify. -* Depending on whether you are the owner of the repository, you can either grant or request access to Netlify so that it can access your repository and build your documentation. -+ -image:netlify/grant_or_request_access.png[Grant or request access, width = 630] -* After granting or requesting access to your repository, click `Authorize netlify`. -+ -. Pick your repository from the list. -+ -. Fill out the details as follows and then click `Deploy site`. -* Branch to deploy: select `master` branch -* Build command: `./gradlew asciidoctor` -+ -[NOTE] -The build command is the command that builds the documentation into HTML format. -+ -* Publish directory: `build/docs/html5` -[NOTE] -The publish directory is the directory in which the built HTML documentation resides. -+ -. Once Netlify has completed building your project, you can now: -* View your main branch's deployed documentation on the site name given by Netlify (customizable as shown <>). -+ -image:netlify/temp_site_name.png[Temporary site name, width = 630] -+ -* Preview the updated documentation whenever a pull request is made by clicking the `Details` hyperlink next to the Netlify test status. -+ -image:netlify/netlify_details.png[Netlify details link, width = 630] - -== Changing the site name of your project -If you don't like the site name given by Netlify, you can change it as follows: - -. Click on `Settings`. -+ -. Then click `Change site name` and fill in your desired site name. -+ -image:netlify/change_site_name.png[Change site name, width = 630] diff --git a/docs/UsingPlantUml.adoc b/docs/UsingPlantUml.adoc deleted file mode 100644 index cfe2533ea84..00000000000 --- a/docs/UsingPlantUml.adoc +++ /dev/null @@ -1,211 +0,0 @@ -= Using PlantUML -:site-section: DeveloperGuide -:imagesDir: images/plantuml -:stylesDir: stylesheets -:experimental: -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -endif::[] - -== Introduction to PlantUML - -PlantUML is a tool used in this project to create UML diagrams. -For more information about the basics of PlantUML, head over to http://plantuml.com/[its official website]. - -== Set up PlantUML - -=== Installing Graphviz - -Graphviz is a dependency that PlantUML requires to generate more advanced diagrams. -Head over to the https://www.graphviz.org/download/[downloads page] on the official Graphviz website and follow instructions to install Graphviz. - -=== Installing the `PlantUML integration` plugin for IntelliJ IDEA - -Go to `Settings` > `Plugins` > `Marketplace` and install the plugin `PlantUML integration`. - -Then go to `Settings` > `Other Settings` > `PlantUML` or search for PlantUML. -Configure the path to the `dot` executable. -This executable can be found in the `/bin` directory where you installed GraphViz. - -.Settings - Other Settings - PlantUML: input the path to your dot executable -image::ConfiguringGraphviz.png[] - -== Create/Edit PlantUML diagrams - -After installing the `PlantUML integration` plugin, simply create or open any `.puml` file to start editing it. - -.Editing `DeleteSequenceDiagram.puml` -image::EditingDeleteSequenceDiagram.png[] -Any changes you make in editor pane on the left will be reflected in the preview pane on the right. -However, do take note that these changes _will not_ be reflected in the developers guide until you export the diagram. -//TODO: Discussion about why we're not using asciidoctor-diagram - -== Export PlantUML diagrams - -The `PlantUML integration` plugin allows you to export individual diagrams to a location of your choosing. -Click the `Save Current Diagram Only` button and choose the location to export the image file. - -NOTE: You will have to `git add` any new diagrams generated! - -== Common tasks - -=== Applying consistent formatting to PlantUML diagrams - -It is highly recommended to consistently color your UML diagrams as an visual aid. -You can achieve this by creating a dictionary of colors and import it like CSS. - -For example, you can create a `Style.puml` with the contents: - -.Style.puml -[source] ----- -... -!define LOGIC_COLOR #3333C4 -!define LOGIC_COLOR_T1 #7777DB -!define LOGIC_COLOR_T2 #5252CE -!define LOGIC_COLOR_T3 #1616B0 -!define LOGIC_COLOR_T4 #101086 -... ----- - -Then you can use it in another PlantUML file like this: - -.UndoSequenceDiagram.puml -[source] ----- -!include Style.puml - -box Logic LOGIC_COLOR_T2 -participant ":LogicManager" as LogicManager LOGIC_COLOR -participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR -participant ":UndoCommand" as UndoCommand LOGIC_COLOR -end box ----- - -You can fine-tune the formatting of PlantUML diagrams with the `skinparam` command. -For example, `skinparam backgroundColor transparent` turns the background of the diagram transparent. - -For a comprehensive list of ``skinparam``s head over to the https://plantuml-documentation.readthedocs.io/en/latest/[unofficial PlantUML skinparam documentation]. - -*** - -=== Repositioning elements in PlantUML diagrams - -While PlantUML's automatic layout engine usually produces satisfactory results, at times the result can be less than ideal, especially on larger diagrams. -Here is an example where the default layout generated by PlantUML has a lot of overlapping lines that are hard to decipher: - -.The UI class diagram without additional formatting -image::RawUiDiagram.png[] - -NOTE: In most cases, you should consider decomposing the diagram into smaller ones or focusing on a more specific portion of the diagram. - -Here are some of the techniques we used in this project to obtain a more palatable diagram. - -==== Link lengths -By default, a short link (`\->`) points to right and a long link (`-\->`) -points downwards. you can extend any link to make it longer (```--\->```). - -.Length of arrows and its effects -image::ArrowLength.png[] - -==== Link directions -Clever usage of arrow directions will resolve most layout issues. -For example, the table below shows how the way in which you specify arrows can results in drastically different layouts for the same diagram. - -.Link directions -[cols="40a,60a"] -|=== -|Source |Result - -|[source, puml] ----- -A --> Z -B --> Z -C --> Z -D --> Z - -A --> 1 -B --> 2 -C --> 3 -D --> 4 ----- -|image::AllDown.png[] - -|[source, puml] ----- -'default is down -A --> Z -'specify down -B -down-> Z -'shorthand for down -C -d-> Z -'arrow lengths take priority -D -down> Z - -A -up-> 1 -B -up-> 2 -C -up-> 3 -D -up-> 4 - ----- -|image::UpAndDown.png[] - -|[source, puml] ----- -A -up-> Z -B -up-> Z -C -up-> Z -D -up-> Z - -A --> 1 -B --> 2 -C --> 3 -D --> 4 - -'Force A B C D -A -right[hidden]- B -B -right[hidden]- C -C -right[hidden]- D ----- -|image::HiddenArrows.png[] -|=== - -==== Reordering definitions -As a general rule of thumb, the layout engine will attempt to order objects in the order in which they are defined. -If there is no formal definition, the objects is taken to be declared upon its first usage. - -.Definition ordering and outcomes -[cols="70a,30a"] -|=== -|Source |Result - -|[source, puml] ----- -A --> B -C --> D ----- -|image::ABeforeC.png[] - -|[source, puml] ----- -'Class C is defined before A -Class C - -A --> B -C --> D ----- -|image::CBeforeA.png[] - -|[source, puml] ----- -package "Rule Of Thumb"{ - Class C - A --> B - C --> D -} ----- -|image::PackagesAndConsistency.png[] -|=== - -TIP: Explicitly define all symbols to avoid any potential layout mishaps. diff --git a/docs/UsingTravis.adoc b/docs/UsingTravis.adoc deleted file mode 100644 index 887c0b09068..00000000000 --- a/docs/UsingTravis.adoc +++ /dev/null @@ -1,140 +0,0 @@ -= Travis CI -:site-section: DeveloperGuide -:imagesDir: images -:stylesDir: stylesheets -ifdef::env-github[] -:note-caption: :information_source: -endif::[] - -[NOTE] -==== -This document was originally written for _AddressBook Level 4_ and hence its screenshots refer to `addressbook-level4`. -For use with _AddressBook Level 3_, wherever `addressbook-level4` is used in the screenshots, you should use *`addressbook-level3`*. -==== - -https://travis-ci.org/[Travis CI] is a _Continuous Integration_ platform for GitHub projects. - -Travis CI can run the projects' tests automatically whenever new code is pushed to the repo. This ensures that existing functionality and features have not been broken by the changes. - -The current Travis CI set up performs the following things whenever someone push code to the repo: - -* Runs the `./gradlew clean test coverage coveralls -i` command (see <> for more details on what this command means). -* Renders documentation from asciidoc to html and automatically publishes them using GitHub Pages. -* Runs additional link:#repository-wide-checks[repository-wide checks]. - -If you would like to customise your travis build further, you can learn more about Travis from https://docs.travis-ci.com/[Travis CI Documentation]. - -== Setting up Travis CI - -. Fork the repo to your own organization. -. Go to https://travis-ci.org/ and click `Sign in with GitHub`, then enter your GitHub account details if needed. -+ -image:signing_in.png[Signing into Travis CI] -+ -. Head to the https://travis-ci.org/profile[Accounts] page, and find the switch for the forked repository. -* If the organization is not shown, click `Review and add` as shown below: -+ -image:review_and_add.png[Review and add] -+ -This should bring you to a GitHub page that manages the access of third-party applications. Depending on whether you are the owner of the repository, you can either grant access -+ -image:grant_access.png[Grant Access] -+ -or request access -+ -image:request_access.png[Request Access] -+ -to Travis CI so that it can access your commits and build your code. -* If repository cannot be found, click `Sync account` -. Activate the switch. -+ -image:flick_repository_switch.png[Activate the switch] -+ -. This repo comes with a link:../.travis.yml[`.travis.yml`] that tells Travis what to do. So there is no need for you to create one yourself. -. To see the CI in action, push a commit to the master branch! -* Go to the repository and see the pushed commit. There should be an icon which will link you to the Travis build. -+ -image:build_pending.png[Commit build] -+ -* As the build is run on a provided remote machine, we can only examine the logs it produces: -+ -image:travis_build.png[Travis build] -+ -. If the build is successful, you should be able to check the coverage details of the tests at http://coveralls.io/[Coveralls] -. Update the link to the 'build status' badge at the top of the `README.adoc` to point to the build status of your own repo. - -== Enabling auto-publishing of documentation - -. Ensure that you have followed the steps above to set up Travis CI. -. On GitHub, create a new user account and give this account collaborator and admin access to the repo. + - Using this account, generate a personal access token https://github.com/settings/tokens/new[here]. -+ -[NOTE] -Personal access tokens are like passwords so make sure you keep them secret! If the personal access token is leaked, please delete it and generate a new one. -+ -[NOTE] -We use a new user account to generate the token for team projects to prevent team members from gaining access to other team members' repos. + -If you are the only one with write access to the repo, you can use your own account to generate the token. -+ --- -* Add a description for the token. (e.g. `Travis CI - deploy docs to gh-pages`) -* Check the `public_repo` checkbox. -* Click `Generate Token` and copy your new personal access token. --- -We will use this token to grant Travis access to the repo. -+ -image:generate_token.png[Generate token] - -. Head to the https://travis-ci.org/profile[Accounts] page, and find the switch for the forked repository. -+ -image:flick_repository_switch.png[Activate the switch] -+ -. Click on the settings button next to the switch. In the Environment Variables section, add a new environment variable with -+ --- -* name: `GITHUB_TOKEN` -* value: personal access token copied in step 1 -* Display value in build log: `OFF` --- -image:travis_add_token.png[Travis add token] -+ -[NOTE] -*Make sure you set `Display value in build log` to `OFF`.* + -Otherwise, other people will be able to see the personal access token and thus have access this repo. + -Similarly, make sure you *do not print `$GITHUB_TOKEN` to the logs* in Travis scripts as the logs are viewable by the public. - -. Now, whenever there's a new commit to master branch, Travis will push the latest documentation to gh-pages branch. - -**To verify that it works,** - -. Trigger Travis to regenerate documentation. To do so, you need to push a new commit to the master branch of the fork. + - Suggested change: Remove the codacy badge from `README`. -. Wait for Travis CI to finish running the build on your new commit. -. Go to the URL `\https://.github.io/addressbook-level3/index.html`. You should see your `README` file displayed. - -== Repository-wide checks - -In addition to running Gradle checks, we also configure Travis CI to run some repository-wide checks. Unlike the Gradle checks which only cover files used in the build process, these repository-wide checks cover _all_ files in the repository. They check for repository rules which are hard to enforce on development machines such as line ending requirements. - -These checks are implemented as POSIX shell scripts, and thus can only be run on POSIX-compliant operating systems such as macOS and Linux. To run all checks locally on these operating systems, execute the following in the repository root directory: - -[source,shell] ----- -./config/travis/run-checks.sh ----- - -Any warnings or errors will be printed out to the console. - -=== Implementing new checks - -Checks are implemented as executable `check-*` scripts within the `config/travis/` directory. The `run-checks.sh` script will automatically pick up and run files named as such. - -Check scripts should print out errors in the following format: - -.... -SEVERITY:FILENAME:LINE: MESSAGE -.... - -where `SEVERITY` is either `ERROR` or `WARN`, `FILENAME` is the path to the file relative to the current directory, `LINE` is the line of the file where the error occurred and `MESSAGE` is the message explaining the error. - -Check scripts must exit with a non-zero exit code if any errors occur. diff --git a/docs/diagrams/ArchitectureDiagram.png b/docs/diagrams/ArchitectureDiagram.png new file mode 100644 index 00000000000..c16c398e916 Binary files /dev/null and b/docs/diagrams/ArchitectureDiagram.png differ diff --git a/docs/diagrams/ArchitectureDiagram.puml b/docs/diagrams/ArchitectureDiagram.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/ArchitectureSequenceDiagram.png b/docs/diagrams/ArchitectureSequenceDiagram.png new file mode 100644 index 00000000000..362f3392313 Binary files /dev/null and b/docs/diagrams/ArchitectureSequenceDiagram.png differ diff --git a/docs/diagrams/ArchitectureSequenceDiagram.puml b/docs/diagrams/ArchitectureSequenceDiagram.puml old mode 100644 new mode 100755 index d1e2ae93675..64ceb3bc2fc --- a/docs/diagrams/ArchitectureSequenceDiagram.puml +++ b/docs/diagrams/ArchitectureSequenceDiagram.puml @@ -13,7 +13,7 @@ activate ui UI_COLOR ui -[UI_COLOR]> logic : execute("delete 1") activate logic LOGIC_COLOR -logic -[LOGIC_COLOR]> model : deletePerson(p) +logic -[LOGIC_COLOR]> model : deleteSupplier(p) activate model MODEL_COLOR model -[MODEL_COLOR]-> logic @@ -34,4 +34,4 @@ deactivate logic ui--[UI_COLOR]> user deactivate ui -@enduml +@endumlreso diff --git a/docs/diagrams/BetterModelClassDiagram.puml b/docs/diagrams/BetterModelClassDiagram.puml deleted file mode 100644 index 7790472da52..00000000000 --- a/docs/diagrams/BetterModelClassDiagram.puml +++ /dev/null @@ -1,21 +0,0 @@ -@startuml -!include style.puml -skinparam arrowThickness 1.1 -skinparam arrowColor MODEL_COLOR -skinparam classBackgroundColor MODEL_COLOR - -AddressBook *-right-> "1" UniquePersonList -AddressBook *-right-> "1" UniqueTagList -UniqueTagList -[hidden]down- UniquePersonList -UniqueTagList -[hidden]down- UniquePersonList - -UniqueTagList *-right-> "*" Tag -UniquePersonList o-right-> Person - -Person o-up-> "*" Tag - -Person *--> Name -Person *--> Phone -Person *--> Email -Person *--> Address -@enduml diff --git a/docs/diagrams/BuySequenceDiagram.png b/docs/diagrams/BuySequenceDiagram.png new file mode 100644 index 00000000000..ee808275085 Binary files /dev/null and b/docs/diagrams/BuySequenceDiagram.png differ diff --git a/docs/diagrams/BuySequenceDiagram.puml b/docs/diagrams/BuySequenceDiagram.puml new file mode 100644 index 00000000000..68a77d11959 --- /dev/null +++ b/docs/diagrams/BuySequenceDiagram.puml @@ -0,0 +1,69 @@ +@startuml +!include style.puml + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant ":BuyCommandParser" as BuyCommandParser LOGIC_COLOR +participant "b:BuyCommand" as BuyCommand LOGIC_COLOR +participant ":CommandResult" as CommandResult LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant ":Model" as Model MODEL_COLOR +end box + +[-> LogicManager : execute("buy g/Apple q/50") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("buy g/Apple q/50") +activate AddressBookParser + +create BuyCommandParser +AddressBookParser -> BuyCommandParser +activate BuyCommandParser + +BuyCommandParser --> AddressBookParser +deactivate BuyCommandParser + +AddressBookParser -> BuyCommandParser : parse("g/Apple q/50") +activate BuyCommandParser + +create BuyCommand +BuyCommandParser -> BuyCommand +activate BuyCommand + +BuyCommand --> BuyCommandParser : b +deactivate BuyCommand + +BuyCommandParser --> AddressBookParser : b +deactivate BuyCommandParser +'Hidden arrow to position the destroy marker below the end of the activation bar. +BuyCommandParser -[hidden]-> AddressBookParser +destroy BuyCommandParser + +AddressBookParser --> LogicManager : b +deactivate AddressBookParser + +LogicManager -> BuyCommand : execute() +activate BuyCommand + +BuyCommand -> Model : addGood(boughtGood) +activate Model + +Model --> BuyCommand +deactivate Model + +create CommandResult +BuyCommand -> CommandResult +activate CommandResult + +CommandResult --> BuyCommand +deactivate CommandResult + +BuyCommand --> LogicManager : result +deactivate BuyCommand + +[<--LogicManager +deactivate LogicManager +@enduml diff --git a/docs/diagrams/CommitActivityDiagram.png b/docs/diagrams/CommitActivityDiagram.png new file mode 100644 index 00000000000..f6a2b782671 Binary files /dev/null and b/docs/diagrams/CommitActivityDiagram.png differ diff --git a/docs/diagrams/CommitActivityDiagram.puml b/docs/diagrams/CommitActivityDiagram.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/DeleteSequenceDiagram.puml b/docs/diagrams/DeleteSequenceDiagram.puml deleted file mode 100644 index 1dc2311b245..00000000000 --- a/docs/diagrams/DeleteSequenceDiagram.puml +++ /dev/null @@ -1,69 +0,0 @@ -@startuml -!include style.puml - -box Logic LOGIC_COLOR_T1 -participant ":LogicManager" as LogicManager LOGIC_COLOR -participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR -participant ":DeleteCommandParser" as DeleteCommandParser LOGIC_COLOR -participant "d:DeleteCommand" as DeleteCommand LOGIC_COLOR -participant ":CommandResult" as CommandResult LOGIC_COLOR -end box - -box Model MODEL_COLOR_T1 -participant ":Model" as Model MODEL_COLOR -end box - -[-> LogicManager : execute("delete 1") -activate LogicManager - -LogicManager -> AddressBookParser : parseCommand("delete 1") -activate AddressBookParser - -create DeleteCommandParser -AddressBookParser -> DeleteCommandParser -activate DeleteCommandParser - -DeleteCommandParser --> AddressBookParser -deactivate DeleteCommandParser - -AddressBookParser -> DeleteCommandParser : parse("1") -activate DeleteCommandParser - -create DeleteCommand -DeleteCommandParser -> DeleteCommand -activate DeleteCommand - -DeleteCommand --> DeleteCommandParser : d -deactivate DeleteCommand - -DeleteCommandParser --> AddressBookParser : d -deactivate DeleteCommandParser -'Hidden arrow to position the destroy marker below the end of the activation bar. -DeleteCommandParser -[hidden]-> AddressBookParser -destroy DeleteCommandParser - -AddressBookParser --> LogicManager : d -deactivate AddressBookParser - -LogicManager -> DeleteCommand : execute() -activate DeleteCommand - -DeleteCommand -> Model : deletePerson(1) -activate Model - -Model --> DeleteCommand -deactivate Model - -create CommandResult -DeleteCommand -> CommandResult -activate CommandResult - -CommandResult --> DeleteCommand -deactivate CommandResult - -DeleteCommand --> LogicManager : result -deactivate DeleteCommand - -[<--LogicManager -deactivate LogicManager -@enduml diff --git a/docs/diagrams/GoodModelClassDiagram.png b/docs/diagrams/GoodModelClassDiagram.png new file mode 100644 index 00000000000..9dfdd4ebb8d Binary files /dev/null and b/docs/diagrams/GoodModelClassDiagram.png differ diff --git a/docs/diagrams/GoodModelClassDiagram.puml b/docs/diagrams/GoodModelClassDiagram.puml new file mode 100644 index 00000000000..0deaf7e55ec --- /dev/null +++ b/docs/diagrams/GoodModelClassDiagram.puml @@ -0,0 +1,15 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +ModelManager -->"1" Good : filtered list +Inventory *-right-> "1" UniqueGoodList + +UniqueGoodList o-right-> Good + +Good *--> GoodName +Good *--> Quantity +Good *--> ThresholdQuantity +@enduml diff --git a/docs/diagrams/LogicClassDiagram.png b/docs/diagrams/LogicClassDiagram.png new file mode 100644 index 00000000000..33098dc1a80 Binary files /dev/null and b/docs/diagrams/LogicClassDiagram.png differ diff --git a/docs/diagrams/LogicClassDiagram.puml b/docs/diagrams/LogicClassDiagram.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/ModelClassDiagram.png b/docs/diagrams/ModelClassDiagram.png new file mode 100644 index 00000000000..1713ab2fb5f Binary files /dev/null and b/docs/diagrams/ModelClassDiagram.png differ diff --git a/docs/diagrams/ModelClassDiagram.puml b/docs/diagrams/ModelClassDiagram.puml index e85a00d4107..231cb599a1b 100644 --- a/docs/diagrams/ModelClassDiagram.puml +++ b/docs/diagrams/ModelClassDiagram.puml @@ -5,52 +5,39 @@ skinparam arrowColor MODEL_COLOR skinparam classBackgroundColor MODEL_COLOR Package Model <>{ -Interface ReadOnlyAddressBook <> Interface Model <> Interface ObservableList <> +Interface ReadOnlyList<> +Interface Version <> +Interface Versionable <> Class AddressBook -Class ReadOnlyAddressBook +Class Inventory +Class TransactionHistory Class Model Class ModelManager Class UserPrefs Class ReadOnlyUserPrefs -Package Person { -Class Person -Class Address -Class Email -Class Name -Class Phone -Class UniquePersonList -} - -Package Tag { -Class Tag -} -} - Class HiddenOutside #FFFFFF HiddenOutside ..> Model -AddressBook .up.|> ReadOnlyAddressBook +AddressBook .up.|> ReadOnlyList +Inventory .up.|> ReadOnlyList +TransactionHistory .up.|> ReadOnlyList + +Version ^-- Versionable + +AddressBook .up.|> Versionable +Inventory .up.|> Versionable +TransactionHistory .up.|> Versionable ModelManager .up.|> Model Model .right.> ObservableList ModelManager o--> "1" AddressBook +ModelManager o--> "1" Inventory +ModelManager o--> "1" TransactionHistory ModelManager o-left-> "1" UserPrefs UserPrefs .up.|> ReadOnlyUserPrefs -AddressBook *--> "1" UniquePersonList -UniquePersonList o--> "*" Person -Person *--> Name -Person *--> Phone -Person *--> Email -Person *--> Address -Person *--> "*" Tag - -Name -[hidden]right-> Phone -Phone -[hidden]right-> Address -Address -[hidden]right-> Email -ModelManager -->"1" Person : filtered list @enduml diff --git a/docs/diagrams/ModelClassDiagram3.puml b/docs/diagrams/ModelClassDiagram3.puml new file mode 100644 index 00000000000..0241ae06bcb --- /dev/null +++ b/docs/diagrams/ModelClassDiagram3.puml @@ -0,0 +1,56 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +Package Model <>{ +Interface ReadOnlyAddressBook <> +Interface Model <> +Interface ObservableList <> +Class AddressBook +Class ReadOnlyAddressBook +Class Model +Class ModelManager +Class UserPrefs +Class ReadOnlyUserPrefs + +Package Supplier { +Class Supplier +Class Address +Class Email +Class Name +Class Phone +Class UniqueSupplierList +} + +Package Offer { +Class Offer +} +} + +Class HiddenOutside #FFFFFF +HiddenOutside ..> Model + +AddressBook .up.|> ReadOnlyAddressBook + +ModelManager .up.|> Model +Model .right.> ObservableList +ModelManager o--> "1" AddressBook +ModelManager o-left-> "1" UserPrefs +UserPrefs .up.|> ReadOnlyUserPrefs + +AddressBook *--> "1" UniqueSupplierList +UniqueSupplierList o--> "*" Supplier +Supplier *--> Name +Supplier *--> Phone +Supplier *--> Email +Supplier *--> Address +Supplier *--> "*" Offer + +Name -[hidden]right-> Phone +Phone -[hidden]right-> Address +Address -[hidden]right-> Email + +ModelManager -->"1" Supplier : filtered list +@enduml diff --git a/docs/diagrams/OfferModelClassDiagram.png b/docs/diagrams/OfferModelClassDiagram.png new file mode 100644 index 00000000000..def64c66506 Binary files /dev/null and b/docs/diagrams/OfferModelClassDiagram.png differ diff --git a/docs/diagrams/OfferModelClassDiagram.puml b/docs/diagrams/OfferModelClassDiagram.puml new file mode 100644 index 00000000000..42b4bd5930c --- /dev/null +++ b/docs/diagrams/OfferModelClassDiagram.puml @@ -0,0 +1,12 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +UniqueOfferList *-right-> "*" Offer + +Offer *--> GoodName +Offer *--> Price + +@enduml diff --git a/docs/diagrams/StorageClassDiagram.png b/docs/diagrams/StorageClassDiagram.png new file mode 100644 index 00000000000..24004927aa7 Binary files /dev/null and b/docs/diagrams/StorageClassDiagram.png differ diff --git a/docs/diagrams/StorageClassDiagram.puml b/docs/diagrams/StorageClassDiagram.puml index 6adb2e156bf..82d1c1eee97 100644 --- a/docs/diagrams/StorageClassDiagram.puml +++ b/docs/diagrams/StorageClassDiagram.puml @@ -7,18 +7,37 @@ skinparam classBackgroundColor STORAGE_COLOR Interface Storage <> Interface UserPrefsStorage <> Interface AddressBookStorage <> +Interface InventoryStorage <> +Interface TransactionHistoryStorage <> Class StorageManager Class JsonUserPrefsStorage Class JsonAddressBookStorage +Class JsonInventoryStorage +Class JsonTransactionHistoryStorage + StorageManager .left.|> Storage StorageManager o-right-> UserPrefsStorage StorageManager o--> AddressBookStorage +StorageManager o--> InventoryStorage +StorageManager o--> TransactionHistoryStorage JsonUserPrefsStorage .left.|> UserPrefsStorage + JsonAddressBookStorage .left.|> AddressBookStorage JsonAddressBookStorage .down.> JsonSerializableAddressBookStorage -JsonSerializableAddressBookStorage .right.> JsonSerializablePerson -JsonSerializablePerson .right.> JsonAdaptedTag +JsonSerializableAddressBookStorage .down.> JsonSerializableSupplier +JsonSerializableSupplier .down.> JsonAdaptedOffer + +JsonInventoryStorage .left.|> InventoryStorage +JsonInventoryStorage .down.> JsonSerializableInventoryStorage +JsonSerializableInventoryStorage .down.> JsonSerializableGood + +JsonTransactionHistoryStorage .left.|> TransactionHistoryStorage +JsonTransactionHistoryStorage .down.> JsonSerializableTransactionHistoryStorage +JsonSerializableTransactionHistoryStorage .down.> JsonSerializableTransaction +JsonSerializableTransaction .down.> JsonSerializableGood +JsonSerializableTransaction .down.> JsonSerializableSupplier + @enduml diff --git a/docs/diagrams/StorageClassDiagram2.puml b/docs/diagrams/StorageClassDiagram2.puml new file mode 100644 index 00000000000..6c3d699f1a7 --- /dev/null +++ b/docs/diagrams/StorageClassDiagram2.puml @@ -0,0 +1,24 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor STORAGE_COLOR +skinparam classBackgroundColor STORAGE_COLOR + +Interface Storage <> +Interface UserPrefsStorage <> +Interface AddressBookStorage <> + +Class StorageManager +Class JsonUserPrefsStorage +Class JsonAddressBookStorage + +StorageManager .left.|> Storage +StorageManager o-right-> UserPrefsStorage +StorageManager o--> AddressBookStorage + +JsonUserPrefsStorage .left.|> UserPrefsStorage +JsonAddressBookStorage .left.|> AddressBookStorage +JsonAddressBookStorage .down.> JsonSerializableAddressBookStorage +JsonSerializableAddressBookStorage .right.> JsonSerializableSupplier +JsonSerializableSupplier .right.> JsonAdaptedOffer +@enduml diff --git a/docs/diagrams/SupplierModelClassDiagram.png b/docs/diagrams/SupplierModelClassDiagram.png new file mode 100644 index 00000000000..a9688fb1f4a Binary files /dev/null and b/docs/diagrams/SupplierModelClassDiagram.png differ diff --git a/docs/diagrams/SupplierModelClassDiagram.puml b/docs/diagrams/SupplierModelClassDiagram.puml new file mode 100644 index 00000000000..bd41a5704ea --- /dev/null +++ b/docs/diagrams/SupplierModelClassDiagram.puml @@ -0,0 +1,22 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +ModelManager -->"1" Supplier : filtered list +AddressBook *-right-> "1" UniqueSupplierList +AddressBook *-right-> "1" UniqueTagList +UniqueOfferList -[hidden]down- UniqueSupplierList +UniqueOfferList -[hidden]down- UniqueSupplierList + +UniqueOfferList *-right-> "*" Offer +UniqueSupplierList o-right-> Supplier + +Supplier o-up-> "*" Offer + +Supplier *--> Name +Supplier *--> Phone +Supplier *--> Email +Supplier *--> Address +@enduml diff --git a/docs/diagrams/TransactionModelClassDiagram.png b/docs/diagrams/TransactionModelClassDiagram.png new file mode 100644 index 00000000000..08718a4ecaf Binary files /dev/null and b/docs/diagrams/TransactionModelClassDiagram.png differ diff --git a/docs/diagrams/TransactionModelClassDiagram.puml b/docs/diagrams/TransactionModelClassDiagram.puml new file mode 100644 index 00000000000..f46ad8e3d96 --- /dev/null +++ b/docs/diagrams/TransactionModelClassDiagram.puml @@ -0,0 +1,25 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 +skinparam arrowColor MODEL_COLOR +skinparam classBackgroundColor MODEL_COLOR + +ModelManager -->"1" Transaction : filtered list +TransactionHistory *-right-> "1" UniqueTransactionList + +UniqueTransactionList o-right-> Transaction + +Transaction *-right->TransactionId +Transaction *-->Good +Transaction *-->Quantity + +SellTransaction -up-|> Transaction +BuyTransaction -up-|> Transaction + +SellTransaction -[hidden]left- BuyTransaction + +BuyTransaction *--> Supplier +BuyTransaction *--> Price +SellTransaction *--> Price + +@enduml diff --git a/docs/diagrams/UiClassDiagram.png b/docs/diagrams/UiClassDiagram.png new file mode 100644 index 00000000000..f7fac819e4f Binary files /dev/null and b/docs/diagrams/UiClassDiagram.png differ diff --git a/docs/diagrams/UiClassDiagram.puml b/docs/diagrams/UiClassDiagram.puml old mode 100644 new mode 100755 index 92746f9fcf7..1e16a1890ff --- a/docs/diagrams/UiClassDiagram.puml +++ b/docs/diagrams/UiClassDiagram.puml @@ -11,8 +11,12 @@ Class UiManager Class MainWindow Class HelpWindow Class ResultDisplay -Class PersonListPanel -Class PersonCard +Class SupplierListPanel +Class SupplierCard +Class GoodListPanel +Class GoodCard +Class TransactionListPanel +Class TransactionCard Class StatusBarFooter Class CommandBox } @@ -33,25 +37,37 @@ UiManager -down-> MainWindow MainWindow --> HelpWindow MainWindow *-down-> CommandBox MainWindow *-down-> ResultDisplay -MainWindow *-down-> PersonListPanel +MainWindow *-down-> SupplierListPanel +MainWindow *-down-> GoodListPanel +MainWindow *-down-> TransactionListPanel MainWindow *-down-> StatusBarFooter -PersonListPanel -down-> PersonCard +SupplierListPanel -down-> SupplierCard +GoodListPanel -down-> GoodCard +TransactionListPanel -down-> TransactionCard MainWindow -left-|> UiPart ResultDisplay --|> UiPart CommandBox --|> UiPart -PersonListPanel --|> UiPart -PersonCard --|> UiPart +SupplierListPanel --|> UiPart +SupplierCard --|> UiPart +GoodListPanel --|> UiPart +GoodCard --|> UiPart +TransactionListPanel --|> UiPart +TransactionCard --|> UiPart StatusBarFooter --|> UiPart HelpWindow -down-|> UiPart -PersonCard ..> Model +SupplierCard ..> Model +GoodCard ..> Model +TransactionCard ..> Model UiManager -right-> Logic MainWindow -left-> Logic -PersonListPanel -[hidden]left- HelpWindow +SupplierListPanel -[hidden]left- HelpWindow +GoodListPanel -[hidden]left- HelpWindow +TransactionListPanel -[hidden]left- HelpWindow HelpWindow -[hidden]left- CommandBox CommandBox -[hidden]left- ResultDisplay ResultDisplay -[hidden]left- StatusBarFooter diff --git a/docs/diagrams/UndoRedoState0.png b/docs/diagrams/UndoRedoState0.png new file mode 100644 index 00000000000..ca71fe34bc8 Binary files /dev/null and b/docs/diagrams/UndoRedoState0.png differ diff --git a/docs/diagrams/UndoRedoState0.puml b/docs/diagrams/UndoRedoState0.puml old mode 100644 new mode 100755 index 96e30744d24..6f4ebfb46ff --- a/docs/diagrams/UndoRedoState0.puml +++ b/docs/diagrams/UndoRedoState0.puml @@ -6,9 +6,9 @@ skinparam ClassBorderColor #000000 title Initial state package States { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab2:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db2:Database__" } State1 -[hidden]right-> State2 State2 -[hidden]right-> State3 diff --git a/docs/diagrams/UndoRedoState1.png b/docs/diagrams/UndoRedoState1.png new file mode 100644 index 00000000000..9421b74c8a0 Binary files /dev/null and b/docs/diagrams/UndoRedoState1.png differ diff --git a/docs/diagrams/UndoRedoState1.puml b/docs/diagrams/UndoRedoState1.puml old mode 100644 new mode 100755 index 01fcb9b2b96..4b7226cdfb3 --- a/docs/diagrams/UndoRedoState1.puml +++ b/docs/diagrams/UndoRedoState1.puml @@ -3,12 +3,12 @@ skinparam ClassFontColor #000000 skinparam ClassBorderColor #000000 -title After command "delete 5" +title After command "delete-s 5" package States <> { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab2:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db2:Database__" } State1 -[hidden]right-> State2 diff --git a/docs/diagrams/UndoRedoState2.png b/docs/diagrams/UndoRedoState2.png new file mode 100644 index 00000000000..3198a10a870 Binary files /dev/null and b/docs/diagrams/UndoRedoState2.png differ diff --git a/docs/diagrams/UndoRedoState2.puml b/docs/diagrams/UndoRedoState2.puml old mode 100644 new mode 100755 index bccc230a5d1..6aec7c698a0 --- a/docs/diagrams/UndoRedoState2.puml +++ b/docs/diagrams/UndoRedoState2.puml @@ -3,12 +3,12 @@ skinparam ClassFontColor #000000 skinparam ClassBorderColor #000000 -title After command "add n/David" +title After command "add-s n/David" package States <> { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab2:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db2:Database__" } State1 -[hidden]right-> State2 diff --git a/docs/diagrams/UndoRedoState3.png b/docs/diagrams/UndoRedoState3.png new file mode 100644 index 00000000000..e1cdd64af1e Binary files /dev/null and b/docs/diagrams/UndoRedoState3.png differ diff --git a/docs/diagrams/UndoRedoState3.puml b/docs/diagrams/UndoRedoState3.puml old mode 100644 new mode 100755 index ea29c9483e4..ebfb6015744 --- a/docs/diagrams/UndoRedoState3.puml +++ b/docs/diagrams/UndoRedoState3.puml @@ -6,9 +6,9 @@ skinparam ClassBorderColor #000000 title After command "undo" package States <> { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab2:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db2:Database__" } State1 -[hidden]right-> State2 diff --git a/docs/diagrams/UndoRedoState4.png b/docs/diagrams/UndoRedoState4.png new file mode 100644 index 00000000000..3a794c9f4cd Binary files /dev/null and b/docs/diagrams/UndoRedoState4.png differ diff --git a/docs/diagrams/UndoRedoState4.puml b/docs/diagrams/UndoRedoState4.puml old mode 100644 new mode 100755 index 1b784cece80..e1cb575702e --- a/docs/diagrams/UndoRedoState4.puml +++ b/docs/diagrams/UndoRedoState4.puml @@ -3,12 +3,12 @@ skinparam ClassFontColor #000000 skinparam ClassBorderColor #000000 -title After command "list" +title After command "list-s" package States <> { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab2:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db2:Database__" } State1 -[hidden]right-> State2 diff --git a/docs/diagrams/UndoRedoState5.png b/docs/diagrams/UndoRedoState5.png new file mode 100644 index 00000000000..b387f052b29 Binary files /dev/null and b/docs/diagrams/UndoRedoState5.png differ diff --git a/docs/diagrams/UndoRedoState5.puml b/docs/diagrams/UndoRedoState5.puml old mode 100644 new mode 100755 index 88927be32bc..1cb22b07bce --- a/docs/diagrams/UndoRedoState5.puml +++ b/docs/diagrams/UndoRedoState5.puml @@ -6,9 +6,9 @@ skinparam ClassBorderColor #000000 title After command "clear" package States <> { - class State1 as "__ab0:AddressBook__" - class State2 as "__ab1:AddressBook__" - class State3 as "__ab3:AddressBook__" + class State1 as "__db0:Database__" + class State2 as "__db1:Database__" + class State3 as "__db3:Database__" } State1 -[hidden]right-> State2 @@ -17,5 +17,5 @@ State2 -[hidden]right-> State3 class Pointer as "Current State" #FFFFF Pointer -up-> State3 -note right on link: State ab2 deleted. +note right on link: State db2 deleted. @end diff --git a/docs/diagrams/UndoSequenceDiagram.png b/docs/diagrams/UndoSequenceDiagram.png new file mode 100644 index 00000000000..8951403003b Binary files /dev/null and b/docs/diagrams/UndoSequenceDiagram.png differ diff --git a/docs/diagrams/UndoSequenceDiagram.puml b/docs/diagrams/UndoSequenceDiagram.puml old mode 100644 new mode 100755 index 410aab4e412..b85a02111ef --- a/docs/diagrams/UndoSequenceDiagram.puml +++ b/docs/diagrams/UndoSequenceDiagram.puml @@ -3,42 +3,44 @@ box Logic LOGIC_COLOR_T1 participant ":LogicManager" as LogicManager LOGIC_COLOR -participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant ":InventoryManagerParser" as InventoryManagerParser LOGIC_COLOR participant "u:UndoCommand" as UndoCommand LOGIC_COLOR end box box Model MODEL_COLOR_T1 participant ":Model" as Model MODEL_COLOR -participant ":VersionedAddressBook" as VersionedAddressBook MODEL_COLOR +participant ":VersionedDatabase" as VersionedDatabase MODEL_COLOR end box [-> LogicManager : execute(undo) activate LogicManager -LogicManager -> AddressBookParser : parseCommand(undo) -activate AddressBookParser +LogicManager -> InventoryManagerParser : parseCommand(undo) +activate InventoryManagerParser create UndoCommand -AddressBookParser -> UndoCommand +InventoryManagerParser -> UndoCommand activate UndoCommand -UndoCommand --> AddressBookParser +UndoCommand --> InventoryManagerParser deactivate UndoCommand -AddressBookParser --> LogicManager : u -deactivate AddressBookParser +InventoryManagerParser --> LogicManager : u +deactivate InventoryManagerParser LogicManager -> UndoCommand : execute() activate UndoCommand -UndoCommand -> Model : undoAddressBook() +UndoCommand -> Model : undo() activate Model -Model -> VersionedAddressBook : undo() -activate VersionedAddressBook +loop each database +Model -> VersionedDatabase : undo() +activate VersionedDatabase -VersionedAddressBook -> VersionedAddressBook :resetData(ReadOnlyAddressBook) -VersionedAddressBook --> Model : -deactivate VersionedAddressBook +VersionedDatabase -> VersionedDatabase :resetData(ReadOnlyList) +VersionedDatabase --> Model : +deactivate VersionedDatabase +end Model --> UndoCommand deactivate Model diff --git a/docs/diagrams/add-remark/CommandInterface.puml b/docs/diagrams/add-remark/CommandInterface.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/add-remark/ParserInterface.puml b/docs/diagrams/add-remark/ParserInterface.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/AbeforeC.puml b/docs/diagrams/plantuml/AbeforeC.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/AllDown.puml b/docs/diagrams/plantuml/AllDown.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/ArrowLength.puml b/docs/diagrams/plantuml/ArrowLength.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/CbeforeA.puml b/docs/diagrams/plantuml/CbeforeA.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/HiddenArrows.puml b/docs/diagrams/plantuml/HiddenArrows.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/PackagesAndConsistency.puml b/docs/diagrams/plantuml/PackagesAndConsistency.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/plantuml/UpAndDown.puml b/docs/diagrams/plantuml/UpAndDown.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/style.puml b/docs/diagrams/style.puml old mode 100644 new mode 100755 diff --git a/docs/diagrams/tracing/LogicSequenceDiagram.puml b/docs/diagrams/tracing/LogicSequenceDiagram.puml old mode 100644 new mode 100755 diff --git a/docs/images/ArchitectureDiagram.png b/docs/images/ArchitectureDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/ArchitectureSequenceDiagram.png b/docs/images/ArchitectureSequenceDiagram.png old mode 100644 new mode 100755 index aa198138f8f..362f3392313 Binary files a/docs/images/ArchitectureSequenceDiagram.png and b/docs/images/ArchitectureSequenceDiagram.png differ diff --git a/docs/images/BetterModelClassDiagram.png b/docs/images/BetterModelClassDiagram.png deleted file mode 100644 index bc7ed18ae29..00000000000 Binary files a/docs/images/BetterModelClassDiagram.png and /dev/null differ diff --git a/docs/images/BuySequenceDiagram.png b/docs/images/BuySequenceDiagram.png new file mode 100644 index 00000000000..ee808275085 Binary files /dev/null and b/docs/images/BuySequenceDiagram.png differ diff --git a/docs/images/CommitActivityDiagram.png b/docs/images/CommitActivityDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/DeleteSequenceDiagram.png b/docs/images/DeleteSequenceDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/DependencyInjection.png b/docs/images/DependencyInjection.png old mode 100644 new mode 100755 diff --git a/docs/images/DependencyInjectionWithoutDIP.png b/docs/images/DependencyInjectionWithoutDIP.png old mode 100644 new mode 100755 diff --git a/docs/images/GoodModelClassDiagram.png b/docs/images/GoodModelClassDiagram.png new file mode 100644 index 00000000000..9dfdd4ebb8d Binary files /dev/null and b/docs/images/GoodModelClassDiagram.png differ diff --git a/docs/images/LogicClassDiagram.png b/docs/images/LogicClassDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/LogicStorageDIP.png b/docs/images/LogicStorageDIP.png old mode 100644 new mode 100755 diff --git a/docs/images/ModelClassDiagram.png b/docs/images/ModelClassDiagram.png old mode 100644 new mode 100755 index 280064118cf..1713ab2fb5f Binary files a/docs/images/ModelClassDiagram.png and b/docs/images/ModelClassDiagram.png differ diff --git a/docs/images/OfferModelClassDiagram.png b/docs/images/OfferModelClassDiagram.png new file mode 100644 index 00000000000..def64c66506 Binary files /dev/null and b/docs/images/OfferModelClassDiagram.png differ diff --git a/docs/images/PrintableInterface.png b/docs/images/PrintableInterface.png old mode 100644 new mode 100755 diff --git a/docs/images/ReadOnlyAddressBookUsage.png b/docs/images/ReadOnlyAddressBookUsage.png old mode 100644 new mode 100755 diff --git a/docs/images/SeEduLogo.png b/docs/images/SeEduLogo.png old mode 100644 new mode 100755 diff --git a/docs/images/StorageClassDiagram.png b/docs/images/StorageClassDiagram.png index d87c1216820..24004927aa7 100644 Binary files a/docs/images/StorageClassDiagram.png and b/docs/images/StorageClassDiagram.png differ diff --git a/docs/images/SupplierModelClassDiagram.png b/docs/images/SupplierModelClassDiagram.png new file mode 100644 index 00000000000..a9688fb1f4a Binary files /dev/null and b/docs/images/SupplierModelClassDiagram.png differ diff --git a/docs/images/TransactionModelClassDiagram.png b/docs/images/TransactionModelClassDiagram.png new file mode 100644 index 00000000000..08718a4ecaf Binary files /dev/null and b/docs/images/TransactionModelClassDiagram.png differ diff --git a/docs/images/Ui.png b/docs/images/Ui.png old mode 100644 new mode 100755 index 5bd77847aa2..f7b6421f5c4 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/images/UiClassDiagram.png b/docs/images/UiClassDiagram.png old mode 100644 new mode 100755 index 7b4b3dbea45..f7fac819e4f Binary files a/docs/images/UiClassDiagram.png and b/docs/images/UiClassDiagram.png differ diff --git a/docs/images/UndoRedoState0.png b/docs/images/UndoRedoState0.png old mode 100644 new mode 100755 index 8f7538cd884..2654735f9d9 Binary files a/docs/images/UndoRedoState0.png and b/docs/images/UndoRedoState0.png differ diff --git a/docs/images/UndoRedoState1.png b/docs/images/UndoRedoState1.png old mode 100644 new mode 100755 index df9908d0948..28f44d43114 Binary files a/docs/images/UndoRedoState1.png and b/docs/images/UndoRedoState1.png differ diff --git a/docs/images/UndoRedoState2.png b/docs/images/UndoRedoState2.png old mode 100644 new mode 100755 index 36519c1015b..a6d37baaeda Binary files a/docs/images/UndoRedoState2.png and b/docs/images/UndoRedoState2.png differ diff --git a/docs/images/UndoRedoState3.png b/docs/images/UndoRedoState3.png old mode 100644 new mode 100755 index 19959d01712..d8c407b25f7 Binary files a/docs/images/UndoRedoState3.png and b/docs/images/UndoRedoState3.png differ diff --git a/docs/images/UndoRedoState4.png b/docs/images/UndoRedoState4.png old mode 100644 new mode 100755 diff --git a/docs/images/UndoRedoState5.png b/docs/images/UndoRedoState5.png old mode 100644 new mode 100755 index 84ad2afa6bd..0e9a07a0421 Binary files a/docs/images/UndoRedoState5.png and b/docs/images/UndoRedoState5.png differ diff --git a/docs/images/UndoSequenceDiagram.png b/docs/images/UndoSequenceDiagram.png old mode 100644 new mode 100755 index 6addcd3a8d9..5ce1bc5bec1 Binary files a/docs/images/UndoSequenceDiagram.png and b/docs/images/UndoSequenceDiagram.png differ diff --git a/docs/images/add-remark/$Remark.png b/docs/images/add-remark/$Remark.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/CommandInterface.png b/docs/images/add-remark/CommandInterface.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/ContextMenu.png b/docs/images/add-remark/ContextMenu.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/CreateTest.png b/docs/images/add-remark/CreateTest.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/GradleRun.png b/docs/images/add-remark/GradleRun.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/ParserInterface.png b/docs/images/add-remark/ParserInterface.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/RemarkBound.png b/docs/images/add-remark/RemarkBound.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/RemarkComplete.png b/docs/images/add-remark/RemarkComplete.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/RemarkFailureOutput.png b/docs/images/add-remark/RemarkFailureOutput.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/RemarkHello.png b/docs/images/add-remark/RemarkHello.png old mode 100644 new mode 100755 diff --git a/docs/images/add-remark/RemarkNotImplemented.png b/docs/images/add-remark/RemarkNotImplemented.png old mode 100644 new mode 100755 diff --git a/docs/images/appveyor/ci-log.png b/docs/images/appveyor/ci-log.png old mode 100644 new mode 100755 diff --git a/docs/images/appveyor/ci-pending.png b/docs/images/appveyor/ci-pending.png old mode 100644 new mode 100755 diff --git a/docs/images/build_pending.png b/docs/images/build_pending.png old mode 100644 new mode 100755 diff --git a/docs/images/checkstyle-idea-configuration.png b/docs/images/checkstyle-idea-configuration.png old mode 100644 new mode 100755 diff --git a/docs/images/checkstyle-idea-scan-scope.png b/docs/images/checkstyle-idea-scan-scope.png old mode 100644 new mode 100755 diff --git a/docs/images/chrome_save_as_pdf.png b/docs/images/chrome_save_as_pdf.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/badge_repo.png b/docs/images/coveralls/badge_repo.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/coverage_asciidoc_code.png b/docs/images/coveralls/coverage_asciidoc_code.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/coverage_report.png b/docs/images/coveralls/coverage_report.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/disable_comments.png b/docs/images/coveralls/disable_comments.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/flick_repository_switch.png b/docs/images/coveralls/flick_repository_switch.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/github_settings.png b/docs/images/coveralls/github_settings.png old mode 100644 new mode 100755 diff --git a/docs/images/coveralls/sync_repos.png b/docs/images/coveralls/sync_repos.png old mode 100644 new mode 100755 diff --git a/docs/images/damithc.jpg b/docs/images/damithc.jpg old mode 100644 new mode 100755 diff --git a/docs/images/fangshaohua94.png b/docs/images/fangshaohua94.png new file mode 100755 index 00000000000..5f0b356b0ea Binary files /dev/null and b/docs/images/fangshaohua94.png differ diff --git a/docs/images/flick_repository_switch.png b/docs/images/flick_repository_switch.png old mode 100644 new mode 100755 diff --git a/docs/images/generate_token.png b/docs/images/generate_token.png old mode 100644 new mode 100755 diff --git a/docs/images/github_repo_settings.png b/docs/images/github_repo_settings.png old mode 100644 new mode 100755 diff --git a/docs/images/grant_access.png b/docs/images/grant_access.png old mode 100644 new mode 100755 diff --git a/docs/images/lejolly.jpg b/docs/images/lejolly.jpg old mode 100644 new mode 100755 diff --git a/docs/images/liuchao93.png b/docs/images/liuchao93.png new file mode 100755 index 00000000000..40fdd58269f Binary files /dev/null and b/docs/images/liuchao93.png differ diff --git a/docs/images/m133225.jpg b/docs/images/m133225.jpg old mode 100644 new mode 100755 diff --git a/docs/images/netlify/change_site_name.png b/docs/images/netlify/change_site_name.png old mode 100644 new mode 100755 diff --git a/docs/images/netlify/grant_or_request_access.png b/docs/images/netlify/grant_or_request_access.png old mode 100644 new mode 100755 diff --git a/docs/images/netlify/netlify_details.png b/docs/images/netlify/netlify_details.png old mode 100644 new mode 100755 diff --git a/docs/images/netlify/temp_site_name.png b/docs/images/netlify/temp_site_name.png old mode 100644 new mode 100755 diff --git a/docs/images/nicholascf.png b/docs/images/nicholascf.png new file mode 100755 index 00000000000..b1c40324da4 Binary files /dev/null and b/docs/images/nicholascf.png differ diff --git a/docs/images/pangjiada.png b/docs/images/pangjiada.png new file mode 100755 index 00000000000..3c70b3535c7 Binary files /dev/null and b/docs/images/pangjiada.png differ diff --git a/docs/images/plantuml/ABeforeC.png b/docs/images/plantuml/ABeforeC.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/AllDown.png b/docs/images/plantuml/AllDown.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/ArrowLength.png b/docs/images/plantuml/ArrowLength.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/CBeforeA.png b/docs/images/plantuml/CBeforeA.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/ConfiguringGraphviz.png b/docs/images/plantuml/ConfiguringGraphviz.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/EditingDeleteSequenceDiagram.png b/docs/images/plantuml/EditingDeleteSequenceDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/HiddenArrows.png b/docs/images/plantuml/HiddenArrows.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/PackagesAndConsistency.png b/docs/images/plantuml/PackagesAndConsistency.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/RawUiDiagram.png b/docs/images/plantuml/RawUiDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/plantuml/UpAndDown.png b/docs/images/plantuml/UpAndDown.png old mode 100644 new mode 100755 diff --git a/docs/images/remove/$address.png b/docs/images/remove/$address.png old mode 100644 new mode 100755 diff --git a/docs/images/remove/SafeDeleteConflicts.png b/docs/images/remove/SafeDeleteConflicts.png old mode 100644 new mode 100755 diff --git a/docs/images/remove/UnsafeDelete.png b/docs/images/remove/UnsafeDelete.png old mode 100644 new mode 100755 diff --git a/docs/images/remove/UnsafeDeleteOnField.png b/docs/images/remove/UnsafeDeleteOnField.png old mode 100644 new mode 100755 diff --git a/docs/images/request_access.png b/docs/images/request_access.png old mode 100644 new mode 100755 diff --git a/docs/images/review_and_add.png b/docs/images/review_and_add.png old mode 100644 new mode 100755 diff --git a/docs/images/signing_in.png b/docs/images/signing_in.png old mode 100644 new mode 100755 diff --git a/docs/images/testfx-idea-accessibility-permissions.png b/docs/images/testfx-idea-accessibility-permissions.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/DebuggerStep1.png b/docs/images/tracing/DebuggerStep1.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/EditCommand.png b/docs/images/tracing/EditCommand.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/Execute.png b/docs/images/tracing/Execute.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/FindUsages.png b/docs/images/tracing/FindUsages.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/LeftGutter.png b/docs/images/tracing/LeftGutter.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/LogicSequenceDiagram.png b/docs/images/tracing/LogicSequenceDiagram.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/ShowExecutionPoint.png b/docs/images/tracing/ShowExecutionPoint.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/StepInto.png b/docs/images/tracing/StepInto.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/StepOver.png b/docs/images/tracing/StepOver.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/StructureToolWindow.png b/docs/images/tracing/StructureToolWindow.png old mode 100644 new mode 100755 diff --git a/docs/images/tracing/Variables.png b/docs/images/tracing/Variables.png old mode 100644 new mode 100755 diff --git a/docs/images/travis_add_token.png b/docs/images/travis_add_token.png old mode 100644 new mode 100755 diff --git a/docs/images/travis_build.png b/docs/images/travis_build.png old mode 100644 new mode 100755 diff --git a/docs/images/yijinl.jpg b/docs/images/yijinl.jpg old mode 100644 new mode 100755 diff --git a/docs/images/yl_coder.jpg b/docs/images/yl_coder.jpg old mode 100644 new mode 100755 diff --git a/docs/index.adoc b/docs/index.adoc index a65ae663288..ed10ce32aed 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -1,2 +1,3 @@ :stylesDir: stylesheets include::../README.adoc[] + diff --git a/docs/stylesheets/asciidoctor.css b/docs/stylesheets/asciidoctor.css old mode 100644 new mode 100755 diff --git a/docs/stylesheets/gh-pages.css b/docs/stylesheets/gh-pages.css old mode 100644 new mode 100755 diff --git a/docs/team/fangshaohua94.adoc b/docs/team/fangshaohua94.adoc new file mode 100755 index 00000000000..159a0c3cd6a --- /dev/null +++ b/docs/team/fangshaohua94.adoc @@ -0,0 +1,39 @@ += Fang Shao Hua - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: InventoryManager + +--- + +== Overview + +InventoryManager is a desktop inventory manager application used for tracking quantity of goods, suppliers and transaction history. 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*: +** What it does: +** Justification: +** Highlights: +** Credits: + +* *Minor enhancement*: + +* *Code contributed*: + +* *Other contributions*: + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide._ +|=== + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide._ +|=== diff --git a/docs/team/johndoe.adoc b/docs/team/johndoe.adoc old mode 100644 new mode 100755 diff --git a/docs/team/liuchao.adoc b/docs/team/liuchao.adoc new file mode 100755 index 00000000000..e2229e733ee --- /dev/null +++ b/docs/team/liuchao.adoc @@ -0,0 +1,53 @@ += Liu Chao - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: Inventory Manager + + --- + + == Overview + + + == Summary of contributions + +* *Major enhancement*: added ** +** What it does: +** Justification: +** Highlights: +** 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 ... + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +** Enhancements to existing features: +** Documentation: +** Community: +** Tools: + + _{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._ + |=== + + == 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._ + |=== + + + == PROJECT: PowerPointLabs + + --- + + _{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/team/nicholascristianfernando.adoc b/docs/team/nicholascristianfernando.adoc new file mode 100755 index 00000000000..1b58d0107c7 --- /dev/null +++ b/docs/team/nicholascristianfernando.adoc @@ -0,0 +1,39 @@ += Nicholas Cristian Fernando - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: InventoryManager + +--- + +== Overview + +InventoryManager is a desktop inventory manager application used for tracking quantity of goods, suppliers and transaction history. 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*: +** What it does: +** Justification: +** Highlights: +** Credits: + +* *Minor enhancement*: + +* *Code contributed*: + +* *Other contributions*: + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide._ +|=== + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide._ +|=== diff --git a/docs/team/pangjiada.adoc b/docs/team/pangjiada.adoc new file mode 100755 index 00000000000..68fddb1bcbd --- /dev/null +++ b/docs/team/pangjiada.adoc @@ -0,0 +1,53 @@ += Pang Jia Da - Project Portfolio +:site-section: AboutUs +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: Inventory Manager + +--- + +== Overview + + +== Summary of contributions + +* *Major enhancement*: added ** +** What it does: +** Justification: +** Highlights: +** 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 ... + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +** Enhancements to existing features: +** Documentation: +** Community: +** Tools: + +_{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._ +|=== + +== 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._ +|=== + + +== PROJECT: PowerPointLabs + +--- + +_{Optionally, you may include other projects in your portfolio.}_ diff --git a/docs/templates/LICENSE b/docs/templates/LICENSE old mode 100644 new mode 100755 diff --git a/docs/templates/_footer.html.slim b/docs/templates/_footer.html.slim old mode 100644 new mode 100755 diff --git a/docs/templates/_footnotes.html.slim b/docs/templates/_footnotes.html.slim old mode 100644 new mode 100755 diff --git a/docs/templates/_header.html.slim b/docs/templates/_header.html.slim old mode 100644 new mode 100755 diff --git a/docs/templates/_toc.html.slim b/docs/templates/_toc.html.slim old mode 100644 new mode 100755 diff --git a/docs/templates/document.html.slim b/docs/templates/document.html.slim old mode 100644 new mode 100755 diff --git a/docs/templates/helpers.rb b/docs/templates/helpers.rb old mode 100644 new mode 100755 index 7060efe223e..d1cdab5320d --- a/docs/templates/helpers.rb +++ b/docs/templates/helpers.rb @@ -45,7 +45,7 @@ module Slim::Helpers ## # Creates an HTML tag with the given name and optionally attributes. Can take - # a block that will run between the opening and closing tags. + # a block that will run between the opening and closing offers. # # @param name [#to_s] the name of the tag. # @param attributes [Hash] @@ -207,11 +207,11 @@ def html_meta_if(name, content) %() if content end - # Returns formatted style/link and script tags for header. + # Returns formatted style/link and script offers for header. def styles_and_scripts scripts = [] styles = [] - tags = [] + offers = [] stylesheet = attr :stylesheet stylesdir = attr :stylesdir, '' @@ -280,21 +280,21 @@ def styles_and_scripts styles.each do |item| if item.key?(:text) - tags << html_tag(:style, {}, item[:text]) + offers << html_tag(:style, {}, item[:text]) else - tags << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href])) + offers << html_tag(:link, rel: 'stylesheet', href: urlize(*item[:href])) end end scripts.each do |item| if item.key? :text - tags << html_tag(:script, {type: item[:type]}, item[:text]) + offers << html_tag(:script, {type: item[:type]}, item[:text]) else - tags << html_tag(:script, type: item[:type], src: urlize(*item[:src])) + offers << html_tag(:script, type: item[:type], src: urlize(*item[:src])) end end - tags.join "\n" + offers.join "\n" end end diff --git a/docs/tutorials/AddRemark.adoc b/docs/tutorials/AddRemark.adoc deleted file mode 100644 index 51044c36494..00000000000 --- a/docs/tutorials/AddRemark.adoc +++ /dev/null @@ -1,425 +0,0 @@ -= Tutorial - Adding a new Command -:toc: macro -:site-section: DeveloperGuide -:imagesDir: ../images/add-remark -:stylesDir: ../stylesheets -:xrefstyle: full -ifdef::env-github[] -:tip-caption: :bulb: -:note-caption: :information_source: -:warning-caption: :warning: -endif::[] - -toc::[] - -== Introduction - -In this tutorial, we'll walk you through the implementation of a new command -- `remark`. - -This command allows users of the AddressBook application to add optional remarks to people in their address book and edit it if required. -The command should have the format of `remark INDEX r/REMARK`. -An example of the command is `remark 2 r/Likes baseball`. - -We'll assume that you have already set up the development environment as outlined in the Developer's Guide. - -== Create a new `remark` command - -Looking in the `logic.command` package, you will notice that each existing command have their own class. -All the commands inherit from the abstract class `Command` which means that they must override `execute()`. -Each `Command` returns an instance of `CommandResult` upon success and `CommandResult#feedbackToUser` is printed to the `ResultDisplay`. - -Let's start by creating a new `RemarkCommand` class in the `src/main/java/seedu/address/logic/command` directory. - -For now, let's keep `RemarkCommand` as simple as possible and print some output. -We accomplish that by returning a `CommandResult` with an accompanying message. - -.RemarkCommand.java -[source, java] ----- -package seedu.address.logic.commands; - -import seedu.address.model.Model; - -/** - * Changes the remark of an existing person in the address book. - */ -public class RemarkCommand extends Command { - - public static final String COMMAND_WORD = "remark"; - - @Override - public CommandResult execute(Model model) { - return new CommandResult("Hello from remark"); - } -} ----- - -=== Hook `RemarkCommand` into the application - -Now that we have our `RemarkCommand` ready to be executed, we need to update `AddressBookParser#parseCommand()` to recognize the `remark` keyword. -Add the new command to the `switch` block by creating a new `case` that returns a new instance of `RemarkCommand`. - -You can refer to the changes in this link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/7d04e49e364dad661cd88f462f01923fba972d2c#diff-5338391f3f6fbb4022c44add6590b74f[diff]. - -=== Run the application - -Run `Main#main` and try out your new `RemarkCommand`. -If everything went well, you should see something like this: - -.Output displayed -image::RemarkHello.png[] - -== Change `RemarkCommand` to throw an exception - -While we have successfully printed a message to `ResultDisplay`, the command does not do what it is supposed to do. -Let's change the command to throw an `CommandException` to accurately reflect that our command is still a work in progress. - -.The relationship between RemarkCommand and Command -image::CommandInterface.png[] - -Following the convention in other commands, we add relevant messages as constants and use them. - -.RemarkCommand.java -[source, java] ----- - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the remark of the person identified " - + "by the index number used in the last person listing. " - + "Existing remark will be overwritten by the input.\n" - + "Parameters: INDEX (must be a positive integer) " - + "r/ [REMARK]\n" - + "Example: " + COMMAND_WORD + " 1 " - + "r/ Likes to swim."; - - public static final String MESSAGE_NOT_IMPLEMENTED_YET = "Remark command not implemented yet"; - - @Override - public CommandResult execute(Model model) throws CommandException { - throw new CommandException(MESSAGE_NOT_IMPLEMENTED_YET); - } ----- - -== Enhancing `RemarkCommand` - -Let's change `RemarkCommand` to parse input from the user. - -=== Make the command accept parameters - -We start by modifying the constructor of `RemarkCommand` to accept an `Index` and a `String`. -While we are at it, let's change the error message to echo the values. -While this is not a replacement for tests, it is an obvious way to tell if our code is functioning as intended. - -[source, java] ----- -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; -//... -public class RemarkCommand extends Command { - //... - public static final String MESSAGE_ARGUMENTS = "Index: %1$d, Remark: %2$s"; - - private final Index index; - private final String remark; - - /** - * @param index of the person in the filtered person list to edit the remark - * @param remark of the person to be updated to - */ - public RemarkCommand(Index index, String remark) { - requireAllNonNull(index, remark); - - this.index = index; - this.remark = remark; - } - @Override - public CommandResult execute(Model model) throws CommandException { - throw new CommandException(String.format(MESSAGE_ARGUMENTS, index.getOneBased(), remark)); - } - - @Override - public boolean equals(Object other) { - // short circuit if same object - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof RemarkCommand)) { - return false; - } - - // state check - RemarkCommand e = (RemarkCommand) other; - return index.equals(e.index) - && remark.equals(e.remark); - } -} ----- - -Your code should look something like link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/83dd9e6b03d6b83199ceb6f3b66166483155abed#diff-34ace715a8a8d2e5a66e71289f017b47[this] after you are done. - -=== Parse user input - -Now let's move on to writing a parser that will extract the index and remark from the input provided by the user. - -Create a `RemarkCommandParser` class in the `seedu.address.logic.parser` package. -The class must extend the `Parser` interface. - -.The relationship between Parser and RemarkCommandParser -image::ParserInterface.png[] - -Thankfully, `ArgumentTokenizer#tokenize()` makes it trivial to parse user input. -Let's take a look at the JavaDoc provided for the function to understand what it does. - -[source, java] -.ArgumentTokenizer.java ----- -/** - * Tokenizes an arguments string and returns an {@code ArgumentMultimap} - * object that maps prefixes to their respective argument values. Only the - * given prefixes will be recognized in the arguments string. - * - * @param argsString Arguments string of the form: - * {@code preamble value value ...} - * @param prefixes Prefixes to tokenize the arguments string with - * @return ArgumentMultimap object that maps prefixes to their - * arguments - */ ----- - -We can tell `ArgumentTokenizer#tokenize()` to look out for our new prefix `r/` and it will return us an instance of `ArgumentMultimap`. -Now let's find out what we need to do in order to obtain the Index and String that we need. -Let's look through `ArgumentMultimap` : - -[source, java] -.ArgumentMultimap.java ----- -/** - * Returns the last value of {@code prefix}. - */ -public Optional getValue(Prefix prefix) { - List values = getAllValues(prefix); - return values.isEmpty() ? Optional.empty() : - Optional.of(values.get(values.size() - 1)); -} ----- - -This appears to be what we need to get a String of the remark. -But what about the Index? Taking a quick peek at existing an `Command`... - -[source, java] -.DeleteCommandParser.java ----- -Index index = ParserUtil.parseIndex(args); -return new DeleteCommand(index); ----- - -There appears to be another utility class that obtains an `Index` from the input provided by the user. - -Now that we have the know-how to extract the data that we need from the user's input, we can create a new instance of `RemarkCommand`. - -[source, java] -.RemarkCommandParser.java ----- -public RemarkCommand parse(String args) throws ParseException { - requireNonNull(args); - ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, - PREFIX_REMARK); - - Index index; - try { - index = ParserUtil.parseIndex(argMultimap.getPreamble()); - } catch (IllegalValueException ive) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, - RemarkCommand.MESSAGE_USAGE), ive); - } - - String remark = argMultimap.getValue(PREFIX_REMARK).orElse(""); - - return new RemarkCommand(index, remark); -} ----- - -NOTE: Don't forget to update `AddressBookParser` to use our new `RemarkCommandParser`! - -If you are stuck, check out the sample link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/efdcdf0e80cec9489f7b47e3f65824f4688ad8f7#diff-fc19ecee89c3732a62fbc8c840250508[here]. - -== Add `Remark` to the model - -Now that we have all the information that we need, let's lay the groundwork for some _persistent_ changes. -We achieve that by working with the `Person` model. -Each field in a Person is implemented as a separate class (e.g. a `Name` object represents the person's name). -That means we should add a `Remark` class so that we can use a `Remark` object to represent a remark given to a person. - -=== Add a new `Remark` class - -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. - -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]. -Note how `Remark` has no constrains and thus does not require input validation. - -=== Make use of `Remark` - -Let's change `RemarkCommand` and `RemarkCommandParser` to use the new `Remark` class instead of plain `String`. -These should be relatively simple changes. - -== Add a placeholder element for remark to the UI - -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. - -Simply add -[source, java] -.PersonCard.java -``` -@FXML -private Label remark; -``` - -to link:https://github.com/nus-cs2103-AY1920S1/addressbook-level3/commit/2758455583f0101ed918a318fc75679270843a0d#diff-0c6b6abcfac8c205e075294f25e851fe[`seedu.address.ui.PersonCard`]. -`@FXML` is an annotation that marks a private or protected field and makes it accessible to FXML. -It might sound like Greek to you right now, don't worry -- we will get back to it later. - -Then insert - -``` -