Skip to content

Commit

Permalink
Merge 834b448 into 03366b7
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardTay748 committed Nov 4, 2019
2 parents 03366b7 + 834b448 commit 8063973
Show file tree
Hide file tree
Showing 45 changed files with 631 additions and 117 deletions.
Binary file added HelpWindow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ checkstyle {
}

run {
enableAssertions = true
enableAssertions(true)
}

jacocoTestReport {
Expand Down Expand Up @@ -75,7 +75,7 @@ dependencies {
}

shadowJar {
archiveBaseName = 'KeyboardFlashCards-1.3'
archiveName = 'KeyboardFlashCards.jar'

destinationDir = file("${buildDir}/jar/")
}
Expand Down
76 changes: 69 additions & 7 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -354,36 +354,98 @@ as a `LinkedList` implementation.

//@@author LeonardTay748
// tag::statistics[]
=== Statistics Feature
The statistics feature allows users to view the overall statistics (i.e. number of good, hard and easy flashcards in application and those completed in test mode)
=== Statistics feature
The statistics feature allows users to view the overall statistics in a single pop-up window.

==== Implementation
This feature is supported by the following classes:

* `StatsCommand` -- Carries the message to be displayed to the user.
* `RatingContainsKeywordPredicate` -- To generate a predicate for good, hard and easy ratings.
* `Model` -- To provide a list of FlashCards given a rating predicate and the statistics from test mode
* `MainWindow` -- Opens a specific window as required.
* `StatsWindow` -- Builds the statistics window display.
* `Model` -- To provide a list of FlashCards given a rating predicate and the statistics from test mode.
* `Stage` -- To create the pop-up window.
* `Scene` -- To create an object that contains all the physical contents of the pop-up window.
* `FlowPane` -- To create the layout of the pop-up window.

The following sequence diagram shows how the `stats` operation works:
The sequence diagram below shows how the statistics operation works.

image::StatisticsSequenceDiagram.png[]
image::StatisticsSequenceDiagram.png[width=700]

The following activity diagram summarizes what happens when a user executes the `stats` command:
The sequence diagram below details how these other classes (i.e. `Stage`, `Scene` and `FlowPane`) work with `StatsWindow` to create the statistics pop-up window.

image::StatisticsShow.png[width=600]

The activity diagram below summarizes what happens when a user executes the `stats` command.

image::StatisticsActivityDiagram.png[]


==== Design Considerations
The following aspect was a consideration when designing the statistics feature.

Aspect: Methods to collect statistics

* **Alternative 1 (Current choice):** Collect total number of good/hard/easy flashcards using predicates and those completed in test mode using the model.
** Pros: This is easy to implement.
** Cons: This requires extra lines of code to combine all the statistics.


* **Alternative 2:** Collect all statistics using the model.
** Pros: This allows the collection of all statistics with minimal methods involved.
** Cons: This requires constant updating of the model when new FlashCards are added, removed or edited.

Alternative 1 was chosen simply because it was easier to implement within the given period of time.

// end::statistics[]

// tag::help[]
=== Help feature
The help feature allows a user to refer to a summary of commands supported by the application.

==== Implementation
This feature is supported by the following classes:

* `HelpCommand` -- Carries the message to be displayed to the user.
* `MainWindow` -- Opens a specific window as required.
* `HelpWindow` -- Builds the help window display.
* `Image` -- To convert a png file into an `Image` object.
* `ImageView` -- To convert an `Image` object into a view.
* `Stage` -- To display the view.

The sequence diagram below shows how the help operation works.

image::HelpSequenceDiagram.png[width=700]

The sequence diagram below details how these other classes (i.e. `Stage`, `Image` and `ImageView`) work with `HelpWindow` to create the help pop-up window.

image::HelpShow.png[width=500]

The activity diagram below summarizes what happens when a user executes the `help` command.

image::HelpActivityDiagram.png[width=300, height=300]


==== Design Considerations
The following aspect was a consideration when designing the help feature.


Aspect: Ways to display the command summary

* **Alternative 1 (Current choice):** Display a snapshot with all the commands supported by the application.
** Pros: The display can be quickly ammended with any addition or removal of command(s).
** Cons: The size of the snapshot displayed needs to be large to ensure sufficient picture resolution.


* **Alternative 2:** Display as text.
** Pros: This results in a higher-resolution display of the command summary.
** Cons: This requires changing the code.


Alternative 1 was chosen simply because it was easier to update the displayed command summary.

// end::help[]

//@@author
=== Logging

Expand Down
16 changes: 11 additions & 5 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ exporting to document files.

=== Get the full list of commands: `help`

This command allow to you to view all the commands available in the application. +
This command allows you to view all the commands available in the application. +
`help`

. Type `help` and press **Enter** to execute it.
Expand All @@ -310,7 +310,7 @@ image::HelpWindow.png[width="600"]

=== View overall statistics: `stats`

This command allow to you to view the number of good, hard and easy flashcards completed during test mode and in the application. +
This command allows you to view three different type of statistics. +
`stats`

To view statistics:
Expand All @@ -321,12 +321,18 @@ image::StatsCommand.png[width="600"]

. The result box will display the message:
+
Displays the number of GOOD, HARD & EASY FlashCards
Statistics displayed
+
image::StatsCommandBox.png[width="600"]

. A bar chart will also be displayed:
. A window will appear, displaying 3 charts:
+
image::Charts.png[width="600"]
+
image::BarChart.png[width="600"]

Starting from the left, the first chart displays the total number of FlashCards rated as good, hard and easy. The second chart displays the total number of FlashCards rated as good, hard and easy that are completed during test mode. The last chart displays your performance (in percentage) for all tests completed. Performance is determined by the ratio of FlashCards rated as good and easy to FlashCards rated as hard.
+
Note that the second and third chart will be empty if the `stats` command is executed before running at least one test, since both of these charts are dependent on the test mode. Furthermore, the statistics displayed on these two charts will reset when the application is closed.

//tag::theme[]
=== Change color themes: `theme [THEMENAME]`
Expand Down
10 changes: 10 additions & 0 deletions docs/diagrams/HelpActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//@@author LeonardTay748
@startuml
start
:User executes help command;
:Gets image of command summary;
:Displays image ;

stop

@enduml
59 changes: 59 additions & 0 deletions docs/diagrams/HelpSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//@@author LeonardTay748
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":HelpCommand" as HelpCommand LOGIC_COLOR
participant ":logic" as Logic LOGIC_COLOR
end box

box UI UI_COLOR_T1
participant ":MainWindow" as MainWindow UI_COLOR
participant ":HelpWindow" as HelpWindow UI_COLOR
end box

box JavaFx EXTERNAL_LIBRARY_COLOR_T1
participant ":Image" as Image EXTERNAL_LIBRARY_COLOR
participant ":ImageView" as ImageView EXTERNAL_LIBRARY_COLOR
participant ":Stage" as Stage EXTERNAL_LIBRARY_COLOR
end box

[-> LogicManager : parseCommand(stats)
activate LogicManager

LogicManager -> HelpCommand : execute(model)
activate HelpCommand
LogicManager <-- HelpCommand : CommandResult
deactivate HelpCommand

[<--LogicManager
deactivate LogicManager

[-> MainWindow : executeCommand(stats)
activate MainWindow


MainWindow -> MainWindow : handleHelp()
activate MainWindow

MainWindow -> HelpWindow : isShowing()
activate HelpWindow
MainWindow <-- HelpWindow : result
deactivate HelpWindow

alt result = false

MainWindow -> HelpWindow : show()
ref over HelpWindow, Stage : show help
MainWindow <-- HelpWindow :
MainWindow <-- MainWindow :

deactivate MainWindow
[<-- MainWindow :
deactivate MainWindow

end


@enduml
43 changes: 43 additions & 0 deletions docs/diagrams/HelpShow.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//@@author LeonardTay748
@startuml
!include style.puml

box UI UI_COLOR_T1
participant ":HelpWindow" as HelpWindow UI_COLOR
end box

box JavaFx EXTERNAL_LIBRARY_COLOR_T1
participant ":Image" as Image EXTERNAL_LIBRARY_COLOR
participant ":ImageView" as ImageView EXTERNAL_LIBRARY_COLOR
participant ":Stage" as Stage EXTERNAL_LIBRARY_COLOR
end box

group sd show help
-> HelpWindow : show()

HelpWindow -> Image : Image()
activate Image
HelpWindow <-- Image : image
deactivate Image

HelpWindow -> ImageView : setImage(image)
activate ImageView
HelpWindow <-- ImageView :
deactivate ImageView

HelpWindow -> Stage : getRoot()
activate Stage
HelpWindow <-- Stage : root
deactivate Stage

HelpWindow -> Stage : show()
activate Stage
HelpWindow <-- Stage :
deactivate Stage

<-- HelpWindow :
deactivate HelpWindow

end

@enduml
7 changes: 4 additions & 3 deletions docs/diagrams/StatisticsActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//@@author LeonardTay748
@startuml
start
:User executes stats command;
repeat
:Gets an Updated Flashcard List based on predicate;
:Gets an updated FlashCard list based on given predicate;
:Gets the size of the list;
:Number of predicate++ ;
repeat while () is ([number of predicate < 3])
:Gets test mode statistics;
:Combines all statistics;
:Gets performance data;
:Gets test statistics;
:Displays all statistics ;

stop
Expand Down
45 changes: 4 additions & 41 deletions docs/diagrams/StatisticsSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//@@author LeonardTay748
@startuml
!include style.puml

Expand All @@ -18,6 +19,7 @@ end box

box JavaFx EXTERNAL_LIBRARY_COLOR_T1
participant ":Scene" as Scene EXTERNAL_LIBRARY_COLOR
participant ":FlowPane" as FlowPane EXTERNAL_LIBRARY_COLOR
participant ":Stage" as Stage EXTERNAL_LIBRARY_COLOR
end box

Expand All @@ -36,7 +38,7 @@ deactivate LogicManager
[-> MainWindow : executeCommand(stats)
activate MainWindow

alt commandResult.isShowStats()

MainWindow -> MainWindow : handleStats()
activate MainWindow

Expand All @@ -56,47 +58,8 @@ activate MainWindow
deactivate Logic

MainWindow -> StatsWindow : show(model)

loop for each rating
activate StatsWindow
StatsWindow -> Model : updateFilteredFlashCardList(rating)
activate Model
StatsWindow <-- Model : ObservableList<FlashCard>
deactivate Model
StatsWindow -> Model : size()
activate Model
StatsWindow <-- Model : number
deactivate Model
end

StatsWindow -> Model : getTestStats()
activate Model
StatsWindow <-- Model : stats[]
deactivate Model

StatsWindow -> Scene : Scene(bar chart)
activate Scene
StatsWindow <-- Scene : scene
deactivate Scene

StatsWindow -> Stage : setScene(scene)
activate Stage
StatsWindow <-- Stage :
deactivate Stage

StatsWindow -> Stage : getRoot()
activate Stage
StatsWindow <-- Stage : root
deactivate Stage


StatsWindow -> Stage : show()
activate Stage
StatsWindow <-- Stage :
deactivate Stage

ref over StatsWindow, Model, Scene, Stage : show statistics
MainWindow <-- StatsWindow :
deactivate StatsWindow
MainWindow <-- MainWindow :

deactivate MainWindow
Expand Down
Loading

0 comments on commit 8063973

Please sign in to comment.