Record Class SavedRobot
java.lang.Object
java.lang.Record
za.co.wethinkcode.robots.server.persistence.SavedRobot
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactionTimeRemainingrecord component.Returns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.name()Returns the value of thenamerecord component.position()Returns the value of thepositionrecord component.intshields()Returns the value of theshieldsrecord component.intshots()Returns the value of theshotsrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SavedRobot
public SavedRobot(String name, RobotKind kind, Position position, Direction direction, int shields, int shots, Status status, Duration actionTimeRemaining) Creates an instance of aSavedRobotrecord class.- Parameters:
name- the value for thenamerecord componentkind- the value for thekindrecord componentposition- the value for thepositionrecord componentdirection- the value for thedirectionrecord componentshields- the value for theshieldsrecord componentshots- the value for theshotsrecord componentstatus- the value for thestatusrecord componentactionTimeRemaining- the value for theactionTimeRemainingrecord component
-
-
Method Details
-
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
shields
public int shields()Returns the value of theshieldsrecord component.- Returns:
- the value of the
shieldsrecord 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
-
actionTimeRemaining
Returns the value of theactionTimeRemainingrecord component.- Returns:
- the value of the
actionTimeRemainingrecord component
-