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 Difficulty
The field for thedifficulty
record component.The field for thedocuments
record component.private final Duration
The field for themaxTime
record component.private final int
The field for thequestionCount
record component.private final int
The field for thescore
record component.private final LocalDateTime
The field for thetimestamp
record component.private final Duration
The field for theusedTime
record component.private final User
The field for theuser
record 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 boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
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.int
Restituisce il numero totale di domande generate nella sessione.int
score()
Restituisce il punteggio ottenuto dal giocatore durante la sessione.Restituisce la data e ora di avvio della sessione di gioco.final String
toString()
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 thetimestamp
record component. -
difficulty
The field for thedifficulty
record component. -
maxTime
-
usedTime
-
questionCount
private final int questionCountThe field for thequestionCount
record component. -
score
private final int scoreThe field for thescore
record 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 evitareNullPointerException
in 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 thecompare
method from their corresponding wrapper classes.
-