Class ScoreManager
java.lang.Object
spinhex.score.ScoreManager
Manages the storage and retrieval of Score objects.
This class provides functionality to add new scores and retrieve all scores
from a file.
-
Constructor Summary
ConstructorsConstructorDescriptionScoreManager
(Path filePath) Constructs a new ScoreManager with the specified file path. -
Method Summary
-
Constructor Details
-
ScoreManager
Constructs a new ScoreManager with the specified file path.- Parameters:
filePath
- the path to the file where scores will be stored
-
-
Method Details
-
add
Adds a new score to the list of scores and saves it to the file.- Parameters:
result
- the Score object to add- Returns:
- the updated list of all scores including the newly added score
- Throws:
IOException
- if an I/O error occurs while writing to the file
-
getAll
Retrieves all scores from the file. If the file doesn't exist, returns an empty list.- Returns:
- a list of all Score objects stored in the file
- Throws:
IOException
- if an I/O error occurs while reading from the file
-