Record Class WorldKnowledge
java.lang.Object
java.lang.Record
za.co.wethinkcode.robots.client.memory.WorldKnowledge
- Record Components:
ipAddress- IpAddress of the Server the Client is connected toport- Port number of the Server the client is connected to ondimensions- size of the world (measured in steps)visibility- how far into the world a given robot can seereloadTime- how long it takes for a robot to reloadrepairTime- how long it takes for a robot to repairmineTime- how long it takes for a robot to place a minemaxShields- maximum number of shields that this world allowsmaxShots- maximum number of shots that this world allows
public record WorldKnowledge(String map, String ipAddress, int port, int[] dimensions, int visibility, int reloadTime, int repairTime, int mineTime, int maxShields, int maxShots)
extends Record
Local record class that stores the knowledge the client has of the world it is connected to.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUtility constant for establishing an unknown worldstatic final StringUtility constant for rendering world knowledge that is unknown -
Constructor Summary
ConstructorsConstructorDescriptionWorldKnowledge(String map, String ipAddress, int port, int[] dimensions, int visibility, int reloadTime, int repairTime, int mineTime, int maxShields, int maxShots) Creates an instance of aWorldKnowledgerecord class. -
Method Summary
Modifier and TypeMethodDescriptionint[]Returns the value of thedimensionsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theipAddressrecord component.map()Returns the value of themaprecord component.intReturns the value of themaxShieldsrecord component.intmaxShots()Returns the value of themaxShotsrecord component.intmineTime()Returns the value of themineTimerecord component.intport()Returns the value of theportrecord component.intReturns the value of thereloadTimerecord component.intReturns the value of therepairTimerecord component.toString()Returns a string representation of this record class.intReturns the value of thevisibilityrecord component.
-
Field Details
-
UNKNOWN
public static final int UNKNOWNUtility constant for establishing an unknown world- See Also:
-
unknownString
Utility constant for rendering world knowledge that is unknown- See Also:
-
-
Constructor Details
-
WorldKnowledge
public WorldKnowledge(String map, String ipAddress, int port, int[] dimensions, int visibility, int reloadTime, int repairTime, int mineTime, int maxShields, int maxShots) Creates an instance of aWorldKnowledgerecord class.- Parameters:
map- the value for themaprecord componentipAddress- the value for theipAddressrecord componentport- the value for theportrecord componentdimensions- the value for thedimensionsrecord componentvisibility- the value for thevisibilityrecord componentreloadTime- the value for thereloadTimerecord componentrepairTime- the value for therepairTimerecord componentmineTime- the value for themineTimerecord componentmaxShields- the value for themaxShieldsrecord componentmaxShots- the value for themaxShotsrecord 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 '=='. -
map
Returns the value of themaprecord component.- Returns:
- the value of the
maprecord component
-
ipAddress
Returns the value of theipAddressrecord component.- Returns:
- the value of the
ipAddressrecord component
-
port
public int port()Returns the value of theportrecord component.- Returns:
- the value of the
portrecord component
-
dimensions
public int[] dimensions()Returns the value of thedimensionsrecord component.- Returns:
- the value of the
dimensionsrecord component
-
visibility
public int visibility()Returns the value of thevisibilityrecord component.- Returns:
- the value of the
visibilityrecord component
-
reloadTime
public int reloadTime()Returns the value of thereloadTimerecord component.- Returns:
- the value of the
reloadTimerecord component
-
repairTime
public int repairTime()Returns the value of therepairTimerecord component.- Returns:
- the value of the
repairTimerecord component
-
mineTime
public int mineTime()Returns the value of themineTimerecord component.- Returns:
- the value of the
mineTimerecord component
-
maxShields
public int maxShields()Returns the value of themaxShieldsrecord component.- Returns:
- the value of the
maxShieldsrecord component
-
maxShots
public int maxShots()Returns the value of themaxShotsrecord component.- Returns:
- the value of the
maxShotsrecord component
-