Record Class SimulationOptions
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.SimulationOptions
- Record Components:
width- number of columns in the simulated gridheight- number of rows in the simulated gridmaxTicks- maximum number of movement ticks to expanddiagonals- whether diagonal movement is allowedmoveSpeed- movement rate used during expansion
public record SimulationOptions(int width, int height, int maxTicks, boolean diagonals, MoveSpeed moveSpeed)
extends Record
Static bounds and movement settings for a simulation run.
-
Constructor Summary
ConstructorsConstructorDescriptionSimulationOptions(int width, int height, int maxTicks, boolean diagonals, MoveSpeed moveSpeed) Creates an instance of aSimulationOptionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether a coordinate is inside the configured grid bounds.booleanReturns the value of thediagonalsrecord component.diagonals(boolean diagonals) Returns a copy with diagonal movement enabled or disabled.final booleanIndicates whether some other object is "equal to" this one.static SimulationOptionsgrid(int width, int height) Creates default options for a bounded grid.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.intmaxTicks()Returns the value of themaxTicksrecord component.maxTicks(int maxTicks) Returns a copy with a different maximum expansion depth.Returns the value of themoveSpeedrecord component.Returns a copy with a different movement speed.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
SimulationOptions
public SimulationOptions(int width, int height, int maxTicks, boolean diagonals, MoveSpeed moveSpeed) Creates an instance of aSimulationOptionsrecord class.
-
-
Method Details
-
grid
Creates default options for a bounded grid.Defaults to diagonal movement enabled, walking movement, and
width * heightexpansion ticks.- Parameters:
width- number of columns in the simulated gridheight- number of rows in the simulated grid
-
maxTicks
Returns a copy with a different maximum expansion depth.- Parameters:
maxTicks- maximum number of movement ticks to expand
-
diagonals
Returns a copy with diagonal movement enabled or disabled.- Parameters:
diagonals- whether diagonal movement is allowed
-
moveSpeed
Returns a copy with a different movement speed.- Parameters:
moveSpeed- movement rate to use during expansion
-
contains
Returns whether a coordinate is inside the configured grid bounds.The floor is ignored because simulation bounds are two-dimensional.
- Parameters:
coord- coordinate to test
-
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 '=='. -
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
maxTicks
public int maxTicks()Returns the value of themaxTicksrecord component.- Returns:
- the value of the
maxTicksrecord component
-
diagonals
public boolean diagonals()Returns the value of thediagonalsrecord component.- Returns:
- the value of the
diagonalsrecord component
-
moveSpeed
Returns the value of themoveSpeedrecord component.- Returns:
- the value of the
moveSpeedrecord component
-