Record Class State
java.lang.Object
java.lang.Record
za.co.wethinkcode.robots.client.memory.State
- Record Components:
shield- the current Number of shields thisClientRobothasshots- the current Number of shots thisClientRobothasstatus- the last knownStatusof this robot;direction- the direction thisClientRobotis facinglastUpdated- when this state was last updated
public record State(int shield, int shots, Status status, Direction direction, Instant lastUpdated, Position position)
extends Record
Internal ClientRobot state record. No methods available
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.static StatefromJson(com.google.gson.JsonObject obj) final inthashCode()Returns a hash code value for this object.Returns the value of thelastUpdatedrecord component.position()Returns the value of thepositionrecord component.intshield()Returns the value of theshieldrecord component.intshots()Returns the value of theshotsrecord component.status()Returns the value of thestatusrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
State
public State(int shield, int shots, Status status, Direction direction, Instant lastUpdated, Position position) Creates an instance of aStaterecord class.- Parameters:
shield- the value for theshieldrecord componentshots- the value for theshotsrecord componentstatus- the value for thestatusrecord componentdirection- the value for thedirectionrecord componentlastUpdated- the value for thelastUpdatedrecord componentposition- the value for thepositionrecord component
-
-
Method Details
-
fromJson
- Throws:
ServerComplianceException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
shield
public int shield()Returns the value of theshieldrecord component.- Returns:
- the value of the
shieldrecord component
-
shots
public int shots()Returns the value of theshotsrecord component.- Returns:
- the value of the
shotsrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
lastUpdated
Returns the value of thelastUpdatedrecord component.- Returns:
- the value of the
lastUpdatedrecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-