Record Class TurnContext.Clock
java.lang.Object
java.lang.Record
lv.id.jc.dicechess.runtime.TurnContext.Clock
- Record Components:
remainingMillis- milliseconds left on the mover's own clockopponentRemainingMillis- milliseconds left on the opponent's clockincrementMillis- the per-turn Fischer increment in milliseconds, credited after each completed turn, ornullwhen the control has none (a sudden-death or per-move game). Feed it to the engine's time manager as the increment term — anullnaturally coalesces to a zero increment
- Enclosing class:
TurnContext
public static record TurnContext.Clock(long remainingMillis, long opponentRemainingMillis, Long incrementMillis)
extends Record
The game clock as of this turn. Present only for a timed game —
TurnContext.clock() is
null when the game is untimed, so a single null check answers "is this game timed?".
Both remaining times are always present together (a game has clocks for both sides or
neither), so they are primitive; only the increment can be absent.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theincrementMillisrecord component.longReturns the value of theopponentRemainingMillisrecord component.longReturns the value of theremainingMillisrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Clock
Creates an instance of aClockrecord class.- Parameters:
remainingMillis- the value for theremainingMillisrecord componentopponentRemainingMillis- the value for theopponentRemainingMillisrecord componentincrementMillis- the value for theincrementMillisrecord component
-
-
Method Details
-
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. -
remainingMillis
public long remainingMillis()Returns the value of theremainingMillisrecord component.- Returns:
- the value of the
remainingMillisrecord component
-
opponentRemainingMillis
public long opponentRemainingMillis()Returns the value of theopponentRemainingMillisrecord component.- Returns:
- the value of the
opponentRemainingMillisrecord component
-
incrementMillis
Returns the value of theincrementMillisrecord component.- Returns:
- the value of the
incrementMillisrecord component
-