Record Class SimulationMovingThreat.Builder
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.threat.SimulationMovingThreat.Builder
- Enclosing class:
SimulationMovingThreat
public static record SimulationMovingThreat.Builder(int id, Coord position, int radius, int penalty)
extends Record
Builder for moving threats.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionavoid()Builds a threat that should be avoided as a final destination.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.id(int id) Sets the source id.penalize()Builds a threat that penalizes matching nodes without rejecting them as final destinations.intpenalty()Returns the value of thepenaltyrecord component.penalty(int penalty) Sets the penalty added to matching nodes.position()Returns the value of thepositionrecord component.intradius()Returns the value of theradiusrecord component.radius(int radius) Sets the Chebyshev radius around the threat coordinate.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Builder
Creates an instance of aBuilderrecord class.- Parameters:
id- the value for theidrecord componentposition- the value for thepositionrecord componentradius- the value for theradiusrecord componentpenalty- the value for thepenaltyrecord component
-
-
Method Details
-
id
Sets the source id.- Parameters:
id- source id
-
radius
Sets the Chebyshev radius around the threat coordinate.- Parameters:
radius- radius around the threat coordinate
-
penalty
Sets the penalty added to matching nodes.- Parameters:
penalty- penalty amount
-
penalize
Builds a threat that penalizes matching nodes without rejecting them as final destinations. -
avoid
Builds a threat that should be avoided as a final destination. -
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 '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
radius
public int radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
penalty
public int penalty()Returns the value of thepenaltyrecord component.- Returns:
- the value of the
penaltyrecord component
-