forked from nus-cs2113-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from jinzihan2002/Zihan-DG-1
Add UML diagram and documentation for Storage in DG
- Loading branch information
Showing
5 changed files
with
116 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@startuml | ||
|
||
!include Style.puml | ||
participant ":TutorLink" as TL LOGIC_COLOR_5 | ||
participant "gradeStorage: GradeStorage" as GS LOGIC_COLOR_4 | ||
participant "grades: ArrayList<Grade>" as AL LOGIC_COLOR_6 | ||
participant "fileScanner: Scanner" as FS LOGIC_COLOR_7 | ||
|
||
create GS | ||
TL -> GS: new GradeStorage(GRADE_FILE_PATH, initialComponentList, initialStudentList) | ||
activate GS | ||
TL <-- GS: gradeStorage: GradeStorage | ||
deactivate GS | ||
|
||
TL -> GS: loadGradeList() | ||
activate GS | ||
|
||
create AL | ||
GS -> AL: new ArrayList<Grade>() | ||
activate AL | ||
GS <-- AL: grades: Grade | ||
deactivate AL | ||
|
||
create FS | ||
GS -> FS: new Scanner(path: String) | ||
activate FS | ||
GS <-- FS: fileScanner: Scanner | ||
deactivate FS | ||
|
||
loop fileScanner.hasNext() | ||
GS -> FS: nextLine() | ||
activate FS | ||
GS <-- FS: currentLine: String | ||
deactivate FS | ||
GS -> GS: getGradeFromFileLine(currentLine: String) | ||
activate GS | ||
GS --> GS: newGrade: Grade | ||
deactivate GS | ||
|
||
alt success | ||
GS -> AL: add(newGrade) | ||
activate AL | ||
GS <-- AL | ||
deactivate AL | ||
else InvalidDataFileLineException | ||
end | ||
|
||
end | ||
|
||
destroy FS | ||
|
||
TL <-- GS: grades: Grade | ||
deactivate GS | ||
|
||
@enduml |
7 changes: 7 additions & 0 deletions
7
src/main/java/tutorlink/exceptions/InvalidDataFileLineException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tutorlink.exceptions; | ||
|
||
public class InvalidDataFileLineException extends TutorLinkException { | ||
public InvalidDataFileLineException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters