Record Class GameReport
java.lang.Object
java.lang.Record
it.unisa.diem.wordageddon_g16.models.GameReport
- Record Components:
user- utente che ha effettuato la sessionedocuments- lista dei documenti selezionati per la partitatimestamp- data e ora di fine sessione di giocodifficulty- livello di difficoltà della sessionemaxTime- tempo massimo previsto per rispondere alle domandeusedTime- tempo effettivamente impiegato nel rispondere alle domandequestionCount- numero totale di domande generatescore- punteggio ottenuto alla fine della sessione
public record GameReport(User user, List<Document> documents, LocalDateTime timestamp, Difficulty difficulty, Duration maxTime, Duration usedTime, int questionCount, int score)
extends Record
Rappresenta un report di una sessione di gioco nell'applicazione Wordageddon.
Include informazioni sul giocatore, i documenti utilizzati, la difficoltà selezionata, il tempo impiegato, il numero di domande e il punteggio ottenuto. Viene utilizzato per memorizzare i risultati delle partite completate.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DifficultyThe field for thedifficultyrecord component.The field for thedocumentsrecord component.private final DurationThe field for themaxTimerecord component.private final intThe field for thequestionCountrecord component.private final intThe field for thescorerecord component.private final LocalDateTimeThe field for thetimestamprecord component.private final DurationThe field for theusedTimerecord component.private final UserThe field for theuserrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionGameReport(User user, List<Document> documents, LocalDateTime timestamp, Difficulty difficulty, Duration maxTime, Duration usedTime, int questionCount, int score) Costruttore compatto per il recordGameReport. -
Method Summary
Modifier and TypeMethodDescriptionRestituisce il livello di difficoltà selezionato per la partita.Restituisce la lista dei documenti utilizzati nella sessione.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.maxTime()Restituisce il tempo massimo concesso per la sessione di gioco, ossia il tempo per rispondere alle domande.intRestituisce il numero totale di domande generate nella sessione.intscore()Restituisce il punteggio ottenuto dal giocatore durante la sessione.Restituisce la data e ora di avvio della sessione di gioco.final StringtoString()Returns a string representation of this record class.usedTime()Restituisce il tempo effettivamente impiegato dal giocatore nel rispondere alle domande.user()Restituisce l’utente che ha giocato la partita.
-
Field Details
-
user
-
documents
-
timestamp
The field for thetimestamprecord component. -
difficulty
The field for thedifficultyrecord component. -
maxTime
-
usedTime
-
questionCount
private final int questionCountThe field for thequestionCountrecord component. -
score
private final int scoreThe field for thescorerecord component.
-
-
Constructor Details
-
GameReport
public GameReport(User user, List<Document> documents, LocalDateTime timestamp, Difficulty difficulty, Duration maxTime, Duration usedTime, int questionCount, int score) Costruttore compatto per il recordGameReport.Se la lista dei documenti è
null, viene inizializzata come lista vuota per evitareNullPointerExceptionin fasi successive.
-
-
Method Details
-
user
-
documents
-
timestamp
Restituisce la data e ora di avvio della sessione di gioco.- Returns:
- istanza di
LocalDateTime
-
difficulty
Restituisce il livello di difficoltà selezionato per la partita.- Returns:
- valore di
Difficulty
-
maxTime
-
usedTime
-
questionCount
public int questionCount()Restituisce il numero totale di domande generate nella sessione.- Returns:
- numero di domande
-
score
public int score()Restituisce il punteggio ottenuto dal giocatore durante la sessione.- Returns:
- punteggio finale
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.
-