Record Class GameSessionState
java.lang.Object
java.lang.Record
it.unisa.diem.wordageddon_g16.models.GameSessionState
- Record Components:
user
- L'utente a cui appartiene la sessionequestions
- Lista delle domande generatedomandaRisposte
- Mappa domanda --> risposta data (-1 se saltata)currentQuestionIndex
- Indice della domanda attualequestionStartTime
- Istante d'inizio delle domande (può essere null se non usato)
- All Implemented Interfaces:
Serializable
public record GameSessionState(User user, List<Question> questions, Map<Question,Integer> domandaRisposte, int currentQuestionIndex, LocalDateTime questionStartTime, int scorePerQuestion, GameParams gameParams)
extends Record
implements Serializable
Rappresenta lo stato temporaneo di una sessione di gioco interrotta in Wordageddon.
Questa record viene serializzato per permettere il salvataggio e il recupero preciso della partita nel punto in cui l'utente ha interrotto.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The field for thecurrentQuestionIndex
record component.The field for thedomandaRisposte
record component.private final GameParams
The field for thegameParams
record component.The field for thequestions
record component.private final LocalDateTime
The field for thequestionStartTime
record component.private final int
The field for thescorePerQuestion
record component.private static final long
private final User
The field for theuser
record component. -
Constructor Summary
ConstructorsConstructorDescriptionGameSessionState
(User user, List<Question> questions, Map<Question, Integer> domandaRisposte, int currentQuestionIndex, LocalDateTime questionStartTime, int scorePerQuestion, GameParams gameParams) Creates an instance of aGameSessionState
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of thecurrentQuestionIndex
record component.Returns the value of thedomandaRisposte
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of thegameParams
record component.final int
hashCode()
Returns a hash code value for this object.Returns the value of thequestions
record component.Returns the value of thequestionStartTime
record component.int
Returns the value of thescorePerQuestion
record component.final String
toString()
Returns a string representation of this record class.user()
Returns the value of theuser
record component.
-
Field Details
-
user
-
questions
-
domandaRisposte
The field for thedomandaRisposte
record component. -
currentQuestionIndex
private final int currentQuestionIndexThe field for thecurrentQuestionIndex
record component. -
questionStartTime
The field for thequestionStartTime
record component. -
scorePerQuestion
private final int scorePerQuestionThe field for thescorePerQuestion
record component. -
gameParams
The field for thegameParams
record component. -
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
GameSessionState
public GameSessionState(User user, List<Question> questions, Map<Question, Integer> domandaRisposte, int currentQuestionIndex, LocalDateTime questionStartTime, int scorePerQuestion, GameParams gameParams) Creates an instance of aGameSessionState
record class.- Parameters:
user
- the value for theuser
record componentquestions
- the value for thequestions
record componentdomandaRisposte
- the value for thedomandaRisposte
record componentcurrentQuestionIndex
- the value for thecurrentQuestionIndex
record componentquestionStartTime
- the value for thequestionStartTime
record componentscorePerQuestion
- the value for thescorePerQuestion
record componentgameParams
- the value for thegameParams
record component
-
-
Method Details
-
user
-
questions
-
domandaRisposte
Returns the value of thedomandaRisposte
record component.- Returns:
- the value of the
domandaRisposte
record component
-
currentQuestionIndex
public int currentQuestionIndex()Returns the value of thecurrentQuestionIndex
record component.- Returns:
- the value of the
currentQuestionIndex
record component
-
questionStartTime
Returns the value of thequestionStartTime
record component.- Returns:
- the value of the
questionStartTime
record component
-
scorePerQuestion
public int scorePerQuestion()Returns the value of thescorePerQuestion
record component.- Returns:
- the value of the
scorePerQuestion
record component
-
gameParams
Returns the value of thegameParams
record component.- Returns:
- the value of the
gameParams
record component
-
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.
-