-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-W13-2] FitTrack #22
base: master
Are you sure you want to change the base?
Changes from 186 commits
8f035e7
de93e86
b786d9a
c362a33
e1591c7
75d8979
b028922
a5c7bc6
93aeb62
29ca26a
b4d6db1
b746292
3f2cedc
bb19f78
e1f2ce6
3baea89
f6c3de1
11f8d5a
da7d9a1
ea1cbfd
52ba4bd
0971c49
da54dc1
e745817
6f3bc32
3d49df3
898ff87
cd70cea
57707f2
2ca9916
e8c9b61
d65536a
7d69e55
d627d89
ede10cb
27330af
e09602e
c3efc0e
9684552
54638bf
320e3d6
03e4bec
89fb56f
e54fb77
95bc537
57c7fa9
a538e8f
9678a96
aa10907
cc74aa9
4c9044f
ae72e9f
d82ad0d
62b13a5
0946bed
16d5a06
6664921
babdbd6
aea96dd
4d59274
5e75de1
cb10c4f
ca690bb
22ed9a7
9d92422
2aa142e
11ab74e
67e9341
5c3457c
fa27c4c
ab7b3c4
b86ec29
1599342
a9a67c1
bb8c893
cc38cf2
6a57017
1aa47aa
c97f175
88b4894
fba8cbf
8b27dfc
4965b96
0b87fd4
e484bf8
973345e
ef800fe
10f4d90
3b33856
641591f
813d0f7
e4328f4
72cd6a8
31c8369
fb73bc8
88c4713
dc00214
2e15f77
db03ae8
caa64a3
2f78230
fcd8367
25ab1f5
8baf003
a33037b
749f9ca
766fdb6
f11edb5
c4c99fc
2429460
3e31a69
c29b0d7
88e798c
faa6d9c
0407a5f
2d15dc2
be8af2f
caca0ab
d674f47
41dcdbc
307f08e
ff07edc
dddbd4d
7404bf1
0faf2c3
10f3da1
3520e35
759a24a
bda276f
5bcdb1d
816a175
4d2edef
0af1b32
226119e
303f7e7
2624865
45f75ca
717ce23
b6dec0d
1cee12d
d38f792
df27a80
a4f5fa8
493e2de
d0fbbce
226c6bc
9e2218a
fb6dd26
2687501
ce05b52
deefed1
04dfc5b
b771c61
5ffbdb9
617cc90
98438eb
160eb23
c1a0082
1f9058e
dee4581
b3631dd
e8cf557
93dc60c
c5070b9
d65e763
aab3c9e
66ae3a3
1ce5be8
ea3098a
e766127
c4e3e28
7178a5f
b28266f
0fd769c
2bf10e8
b781514
332830b
3a46c44
63078b5
6a95f27
59459f2
59d7e03
db6e070
41e9850
93d6150
7e069a0
66f6115
fc22211
77398ca
d64cd83
b359180
9f3a672
0075c64
89dd172
5001b50
ab0b8bf
6573bf7
f0a4f8e
dee71e9
94f900b
85051d5
4291b4d
c348ec9
e8a9471
a71af52
f41fff2
ea64fc1
dac86de
f6da4c4
e6338f4
ab26ad6
340f387
85678fb
5ef38a3
8ecfa09
d816cd6
f810785
8ff5da9
c835d14
acd1175
07b9755
c6b71c5
12aa540
5b2f65a
97682a8
bcc6982
5e2efc9
3679bc7
d5370c7
e9394fc
4717a5b
2769193
c3ee374
61d432e
3b8d23b
38e3631
24d05a7
43c9494
15c0e04
7746629
77c7e1a
3b34ba1
639c903
bfe6bf4
78479f9
06fe873
8da8723
e2aee92
97cd54f
5a63a3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
FitTrackLogger.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Oct 29, 2024 12:37:24 PM fittrack.logger.FitTrackLogger setupLogger | ||
INFO: Logger successfully initialized | ||
Oct 29, 2024 12:37:24 PM fittrack.storage.Storage initialiseSaveFile | ||
INFO: Accessing existing save file... | ||
Oct 29, 2024 12:37:24 PM fittrack.storage.Storage loadSaveFile | ||
INFO: Save file successfully loaded. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,6 @@ checkstyle { | |
} | ||
|
||
run{ | ||
enableAssertions = true | ||
standardInput = System.in | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:----------:|:----------------------------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Zackermax See Zheng Feng | [Github](https://github.com/Zackermax) | [Portfolio](docs/team/zackermaxsee.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ng Chee Kiang | [Github](https://github.com/CheeKiangg) | [Portfolio](docs/team/CheeKiang.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Marcus Wong | [Github](https://github.com/TheDinos) | [Portfolio](docs/team/marcuswong.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Avjay Bhar | [Github](https://github.com/Yvorm) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ayushi Yadav | [Github](https://github.com/ayushi0803) | [Portfolio](docs/team/ayushi.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@startuml | ||
|
||
skinparam linetype ortho | ||
hide circle | ||
skinparam classAttributeIconSize 0 | ||
skinparam classBackgroundColor White | ||
skinparam classBorderColor Black | ||
|
||
' Abstract class | ||
abstract class Calculator { | ||
- static final int AGE_RANGE_LOWER_START : int | ||
- static final int AGE_RANGE_LOWER_END : int | ||
- static final int AGE_RANGE_UPPER_START : int | ||
- static final int AGE_RANGE_UPPER_END : int | ||
+ static getPointsFromTable(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int, int, boolean) : int | ||
+ static addAgeSubTable(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int, int[][], boolean) : void | ||
+ static addAllTables(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int[][][], boolean) : void | ||
} | ||
|
||
' Derived classes | ||
class PullUpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> pullUpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class ShuttleRunCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> shuttleRunTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class SitAndReachCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> sitAndReachTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class SitUpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> sitUpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class StandingBroadJumpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> broadJumpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class WalkAndRunCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> walkAndRunTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
' Relationships | ||
Calculator <|--- PullUpCalculator | ||
Calculator <|-- ShuttleRunCalculator | ||
Calculator <|--- SitAndReachCalculator | ||
Calculator <|-- SitUpCalculator | ||
Calculator <|--- StandingBroadJumpCalculator | ||
Calculator <|-- WalkAndRunCalculator | ||
|
||
@enduml |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overall, really well structured DG, diagrams really clarify the functionalities of the app |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,77 @@ | |
|
||
## Design & implementation | ||
|
||
# High Level Functionalities | ||
![HighLevel.png](HighLevel.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the roles be closer to the arrow? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somewhat complex class diagram. Maybe split into components? |
||
|
||
**FitTrack** is the main class and entry point of the application. | ||
It manages high level functionalities by coordinating the `FitTrackLogger`, `Storage`, `User`, `Parser`, `Ui`, `TrainingSession`, and `Exercise` classes. | ||
|
||
- **FitTrackLogger** manages logging for the application, ensuring errors and important events are properly recorded. | ||
- **Storage** manages saving and loading data from a persistent storage file. | ||
- **User** holds the user’s information, such as age and gender, and provides methods to modify or retrieve this data. | ||
- **Parser** handles parsing of user input, converting it into commands and actions. | ||
- **Ui** manages all output and user interaction, such as printing data and messages to the console. | ||
- **TrainingSession** represents a single training session, including exercises and metadata (like date and description). | ||
- **Exercise** represents different types of exercises available in the application, like pull-ups or shuttle runs. | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
### Edit Exercise Feature | ||
|
||
The **Edit Exercise** feature is managed by the `TrainingSession` class, and is primarily carried out by its | ||
`editExercise()` function. This feature utilizes the `setPerformance()`and `getReps()` methods from the | ||
`ExerciseStation` classes to edit the repetitions and timings for the user’s selected | ||
exercises. Additionally, it calculates the points the user will earn for each exercise based on the updated values. | ||
|
||
#### Step 1: Logging a New Training Session | ||
|
||
When the user logs a new training session, an instance of the `TrainingSession` class is created. This instance | ||
initializes an EnumMap, which populates the various `ExerciseStation` instances with their initial values. | ||
Below is a representation of how the `ExerciseStations` are initialized: | ||
|
||
![TrainingSessionInitialState.png](TrainingSessionInitialState.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
#### Step 2: Editing a Training Session | ||
|
||
When the user wishes to edit a training session, they specify an `Exercise` Enum, and the reps/timing to be inputted, | ||
which is passed to the`editExercise` function. This function calls the relevant methods to update the repetitions or | ||
timings and calculates the corresponding points for the specified exercise. | ||
|
||
The following sequence diagram illustrates the function calls involved in this process: | ||
|
||
![editExerciseSequenceDiagram.png](editExerciseSequenceDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should activation bars be either added here or removed in the next sequence diagram to follow a standard format? |
||
|
||
Additionally, the state diagram below shows the end state of the `editExercise` function after execution of the command, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The state diagram is a specific kind of UML behavioral diagram.
I don't think that's what you're referring to here, as this seems like structural? |
||
`editExercise(Exercise.PULL_UP, 1)`: | ||
|
||
![TrainingSessionEditState.png](TrainingSessionEditState.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
### Points Calculation Feature | ||
|
||
The **points calculation feature** is a significant part of the `ExerciseStation` system. It allows for the calculation | ||
of user-specific points based on their performance in various exercises (e.g., pull-ups, sit-ups). This process | ||
involves interaction between the `ExerciseStation` and the `Calculator` classes, ensuring that the correct points are | ||
assigned based on predefined lookup tables. | ||
|
||
#### 1. Class Interaction Overview | ||
|
||
Each `ExerciseStation` subclass (e.g., `PullUpStation`, `SitUpStation`) has its own implementation of the `getPoints()` | ||
method. The main responsibility of this method is to invoke the `calculatePoints()` function from the | ||
respective **calculator** class (e.g., `PullUpCalculator`, `SitUpCalculator`), which holds the points calculation logic. | ||
|
||
![getPointsSequenceDiagram.png](getPointsSequenceDiagram.png) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the "PullUpStation" and "PullUpCalculator" be named to be generic names to showcase what is written in the description? |
||
##### Sequence of Events: | ||
|
||
1. **User Inputs Performance**: The user’s performance (e.g., number of pull-ups) is passed to the | ||
`setPerformance()` method in the exercise station. | ||
|
||
2. **Invoke Points Calculation**: Once the performance is set, the `getPoints()` method is called. | ||
This method interacts with the calculator class (e.g., `PullUpCalculator`) to compute the points. | ||
|
||
3. **Calculator Logic**: The calculator class uses a lookup table, which maps the user's performance | ||
to points based on their age and gender. The points are returned to the exercise station, where they are stored. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the user stories below still unchanged from the template? |
||
|
||
## Product scope | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
### Target user profile | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this supposed to be a high-level overview of your entire program? Inclusion of low-level implementation details seems counter to what an overview is supposed to do. Additionally, for a class diagram, labels require the arrowhead, which is not present here. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
@startuml | ||
' Use right-angle straight lines for relationships | ||
skinparam linetype ortho | ||
hide circle | ||
skinparam classAttributeIconSize 0 | ||
skinparam classBackgroundColor White | ||
skinparam classBorderColor Black | ||
|
||
' Define classes | ||
class FitTrack { | ||
+main() | ||
} | ||
|
||
class Parser { | ||
+parse() | ||
+getExercise() | ||
} | ||
|
||
class Ui { | ||
+printGreeting() | ||
+printUser() | ||
+printHelp() | ||
+printAddedSession() | ||
+printDeletedSession() | ||
+printSessionList() | ||
+printSessionView() | ||
+printUnrecognizedInputMessage() | ||
} | ||
|
||
class Storage { | ||
+initialiseSaveFile() | ||
+loadSaveFile() | ||
+updateSaveFile() | ||
} | ||
|
||
class TrainingSession { | ||
-LocalDateTime sessionDateTime | ||
-String description | ||
-User user | ||
+editExercise() | ||
+printSessionDescription() | ||
+viewSession() | ||
} | ||
|
||
class User { | ||
-String gender | ||
-int age | ||
+setGender() | ||
+setAge() | ||
+getGender() | ||
+getAge() | ||
} | ||
|
||
enum Exercise <<enumeration>> { | ||
PULL_UP | ||
SHUTTLE_RUN | ||
SIT_AND_REACH | ||
SIT_UP | ||
STANDING_BROAD_JUMP | ||
WALK_AND_RUN | ||
} | ||
|
||
class FitTrackLogger { | ||
+setupLogger() | ||
} | ||
|
||
' Define relationships with right-angle arrows | ||
FitTrack "1" --> "1" Parser : uses | ||
FitTrack "1" --> "1" Ui : uses | ||
FitTrack "1" --> "1" Storage : uses | ||
FitTrack "1" --> "1" User : manipulates | ||
FitTrack "1" --> "1" FitTrackLogger : uses | ||
|
||
Parser "1" --> "*" TrainingSession : manipulates | ||
Parser "1" --> Exercise : gets | ||
Parser "1" --> "1" User : manipulates | ||
Parser "1" --> "1" Ui : uses | ||
|
||
Ui "1" -> "1" User : displays | ||
Ui "1" --> "*" TrainingSession : displays | ||
|
||
Storage "1" --> "*" TrainingSession : manages | ||
Storage "1" --> "1" FitTrackLogger : uses | ||
|
||
TrainingSession "*" ---> "1" User : belongs to | ||
TrainingSession "*" --> Exercise : contains | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
@startuml | ||
|
||
' Abstract class | ||
abstract class ExerciseStation { | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) | ||
+ getName() : String | ||
+ toString() : String | ||
- points : int | ||
} | ||
|
||
' Classes that extend ExerciseStation | ||
class PullUpStation { | ||
- name : String = "Pull Up Station" | ||
- reps : int | ||
+ PullUpStation() | ||
+ getReps() : int | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
class ShuttleRunStation { | ||
- name : String = "Shuttle Run Station" | ||
- time : int | ||
+ ShuttleRunStation() | ||
+ getTime() : String | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
class SitAndReachStation { | ||
- name : String = "Sit and Reach Station" | ||
- length : int | ||
+ SitAndReachStation() | ||
+ getLength() : int | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
class SitUpStation { | ||
- name : String = "Sit Up Station" | ||
- reps : int | ||
+ SitUpStation() | ||
+ getReps() : int | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
class StandingBroadJumpStation { | ||
- name : String = "Standing Broad Jump Station" | ||
- distance : int | ||
+ StandingBroadJumpStation() | ||
+ getDistance() : int | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
class WalkAndRunStation { | ||
- name : String = "Walk and Run Station" | ||
- time : int | ||
+ WalkAndRunStation() | ||
+ getTime() : String | ||
+ setPerformance(int performanceResult) | ||
+ getPoints(User user) : int | ||
+ getName() : String | ||
+ toString() : String | ||
} | ||
|
||
' Relationship between ExerciseStation and its subclasses | ||
ExerciseStation <|-- PullUpStation | ||
ExerciseStation <|-- ShuttleRunStation | ||
ExerciseStation <|-- SitAndReachStation | ||
ExerciseStation <|-- SitUpStation | ||
ExerciseStation <|-- StandingBroadJumpStation | ||
ExerciseStation <|-- WalkAndRunStation | ||
|
||
@enduml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diagram is abit hard to look at