Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge 02a4c63 into 4a8e46c
Browse files Browse the repository at this point in the history
  • Loading branch information
j-lum committed Jul 24, 2019
2 parents 4a8e46c + 02a4c63 commit b2ea4c1
Show file tree
Hide file tree
Showing 72 changed files with 971 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,7 @@ src/test/data/sandbox/

# MacOS custom attributes files created by Finder
.DS_Store

# style.png generated from the style.puml file
/docs/images/style.png
/docs/images/plantuml/style.png
49 changes: 32 additions & 17 deletions build.gradle
Expand Up @@ -4,10 +4,20 @@

import org.gradle.api.tasks.testing.logging.TestLogEvent

buildscript {
dependencies {
classpath('com.cosminpolifronie.gradle:gradle-plantuml-plugin:1.6.0') {
exclude group: 'net.sourceforge.plantuml', module: 'plantuml'
}
classpath 'net.sourceforge.plantuml:plantuml:1.2019.7'
}
}

plugins {
id 'java'
id 'jacoco'
id 'checkstyle'
id 'com.cosminpolifronie.gradle.plantuml' version '1.6.0'
id 'com.github.kt3k.coveralls' version '2.4.0'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'org.asciidoctor.convert' version '1.5.6'
Expand Down Expand Up @@ -167,10 +177,10 @@ task headless {
println 'Setting headless mode properties.'
test {
systemProperties = [
'testfx.robot': 'glass',
'testfx.headless': 'true',
'prism.order': 'sw',
'prism.text': 't2k',
'testfx.robot': 'glass',
'testfx.headless': 'true',
'prism.order': 'sw',
'prism.text': 't2k',
]
}
}
Expand All @@ -185,22 +195,22 @@ asciidoctor {
outputDir "${buildDir}/docs"

options = [
template_dirs: [file("${sourceDir}/templates")],
template_dirs: [file("${sourceDir}/templates")],
]

attributes = [
linkcss: true,
stylesheet: 'gh-pages.css',
'source-highlighter': 'coderay',
icons: 'font',
experimental: true,
sectlinks: true,
idprefix: '', // for compatibility with GitHub preview
idseparator: '-',
'site-root': "${sourceDir}", // must be the same as sourceDir, do not modify
'site-name': 'AddressBook-Level4',
'site-githuburl': 'https://github.com/se-edu/addressbook-level4',
'site-seedu': true, // delete this line if your project is not a fork (not a SE-EDU project)
linkcss: true,
stylesheet: 'gh-pages.css',
'source-highlighter': 'coderay',
icons: 'font',
experimental: true,
sectlinks: true,
idprefix: '', // for compatibility with GitHub preview
idseparator: '-',
'site-root': "${sourceDir}", // must be the same as sourceDir, do not modify
'site-name': 'AddressBook-Level4',
'site-githuburl': 'https://github.com/se-edu/addressbook-level4',
'site-seedu': true, // delete this line if your project is not a fork (not a SE-EDU project)
]

options['template_dirs'].each {
Expand All @@ -227,6 +237,11 @@ task deployOfflineDocs(type: Copy) {
}
}

plantUml {
render input: 'docs/diagrams/*.puml', output: 'docs/images', format: 'png'
render input: 'docs/diagrams/plantuml/*.puml', output: 'docs/images/plantuml', format: 'png'
}

deployOfflineDocs.dependsOn asciidoctor
processResources.dependsOn deployOfflineDocs

Expand Down
41 changes: 23 additions & 18 deletions docs/DeveloperGuide.adoc
Expand Up @@ -26,12 +26,13 @@ Refer to the guide <<SettingUp#, here>>.
=== Architecture

.Architecture Diagram
image::Architecture.png[width="600"]
image::ArchitectureDiagram.png[]

The *_Architecture Diagram_* given above explains the high-level design of the App. Given below is a quick overview of each component.

[TIP]
The `.pptx` files used to create diagrams in this document can be found in the link:{repoURL}/docs/diagrams/[diagrams] folder. To update a diagram, modify the diagram in the pptx file, select the objects of the diagram, and choose `Save as picture`.
The `.puml` files used to create diagrams in this document can be found in the link:{repoURL}/docs/diagrams/[diagrams] folder.
Refer to the <<UsingPlantUml#, Using PlantUML guide>> to learn how to create and edit diagrams.

`Main` has two classes called link:{repoURL}/src/main/java/seedu/address/Main.java[`Main`] and link:{repoURL}/src/main/java/seedu/address/MainApp.java[`MainApp`]. It is responsible for,

Expand All @@ -58,23 +59,23 @@ Each of the four components
For example, the `Logic` component (see the class diagram given below) defines it's API in the `Logic.java` interface and exposes its functionality using the `LogicManager.java` class.

.Class Diagram of the Logic Component
image::LogicClassDiagram.png[width="800"]
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`.

.Component interactions for `delete 1` command
image::SDforDeletePerson.png[width="800"]
image::ArchitectureSequenceDiagram.png[]

The sections below give more details of each component.

[[Design-Ui]]
=== UI component

.Structure of the UI Component
image::UiClassDiagram.png[width="800"]
image::UiClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]

Expand All @@ -92,7 +93,7 @@ The `UI` component,

[[fig-LogicClassDiagram]]
.Structure of the Logic Component
image::LogicClassDiagram.png[width="800"]
image::LogicClassDiagram.png[]

*API* :
link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]
Expand All @@ -106,13 +107,15 @@ link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]
Given below is the Sequence Diagram for interactions within the `Logic` component for the `execute("delete 1")` API call.

.Interactions Inside the Logic Component for the `delete 1` Command
image::DeletePersonSdForLogic.png[width="800"]
image::DeleteSequenceDiagram.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.

[[Design-Model]]
=== Model component

.Structure of the Model Component
image::ModelClassDiagram.png[width="800"]
image::ModelClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/model/Model.java[`Model.java`]

Expand All @@ -126,13 +129,13 @@ The `Model`,
[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:ModelClassBetterOopDiagram.png[width="800"]
image:BetterModelClassDiagram.png[]

[[Design-Storage]]
=== Storage component

.Structure of the Storage Component
image::StorageClassDiagram.png[width="800"]
image::StorageClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/storage/Storage.java[`Storage.java`]

Expand Down Expand Up @@ -168,29 +171,31 @@ Given below is an example usage scenario and how the undo/redo mechanism behaves

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.

image::UndoRedoStartingStateListDiagram.png[width="800"]
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.

image::UndoRedoNewCommand1StateListDiagram.png[width="800"]
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`.

image::UndoRedoNewCommand2StateListDiagram.png[width="800"]
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`.

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.

image::UndoRedoExecuteUndoStateListDiagram.png[width="800"]
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:

image::UndoRedoSequenceDiagram.png[width="800"]
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.

Expand All @@ -199,15 +204,15 @@ If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, poin

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.

image::UndoRedoNewCommand3StateListDiagram.png[width="800"]
image::UndoRedoState4.png[].png[width="800"]

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.

image::UndoRedoNewCommand4StateListDiagram.png[width="800"]
image::UndoRedoState5.png[]

The following activity diagram summarizes what happens when a user executes a new command:

image::UndoRedoActivityDiagram.png[width="650"]
image::CommitActivityDiagram.png[]

==== Design Considerations

Expand Down
6 changes: 5 additions & 1 deletion docs/Documentation.adoc
Expand Up @@ -26,7 +26,11 @@ We chose asciidoc over Markdown because asciidoc, although a bit more complex th
See <<UsingGradle#rendering-asciidoc-files, UsingGradle.adoc>> 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.

== Publishing Documentation
=== Editing Diagrams

See <<UsingPlantUml#, UsingPlantUml.adoc>> to find out how to create and update the UML diagrams in the developer guide.

=== Publishing Documentation

See <<UsingTravis#deploying-github-pages, UsingTravis.adoc>> to learn how to deploy GitHub Pages using Travis.

Expand Down

0 comments on commit b2ea4c1

Please sign in to comment.