Record Class SimulationThreat.Builder
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.threat.SimulationThreat.Builder
- Enclosing class:
SimulationThreat
public static record SimulationThreat.Builder(SimulationThreatKind kind, int id, Coord position, int startTick, int duration, int radius, int penalty)
extends Record
Builder for coordinate threats.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(SimulationThreatKind kind, int id, Coord position, int startTick, int duration, int radius, int penalty) Creates an instance of aBuilderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionactive(int startTick, int duration) Sets the active tick range.always()Marks this threat as active for the full simulation horizon.avoid()Builds a threat that should be avoided as a final destination.intduration()Returns the value of thedurationrecord component.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.kind()Returns the value of thekindrecord component.kind(SimulationThreatKind kind) Sets the source kind.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.intReturns the value of thestartTickrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Builder
public Builder(SimulationThreatKind kind, int id, Coord position, int startTick, int duration, int radius, int penalty) Creates an instance of aBuilderrecord class.- Parameters:
kind- the value for thekindrecord componentid- the value for theidrecord componentposition- the value for thepositionrecord componentstartTick- the value for thestartTickrecord componentduration- the value for thedurationrecord componentradius- the value for theradiusrecord componentpenalty- the value for thepenaltyrecord component
-
-
Method Details
-
kind
Sets the source kind.- Parameters:
kind- broad source category
-
id
Sets the source id.- Parameters:
id- source id
-
active
Sets the active tick range.- Parameters:
startTick- first simulated tick when this hazard is activeduration- number of simulated ticks this hazard remains active
-
always
Marks this threat as active for the full simulation horizon. -
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 '=='. -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
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
-
startTick
public int startTick()Returns the value of thestartTickrecord component.- Returns:
- the value of the
startTickrecord component
-
duration
public int duration()Returns the value of thedurationrecord component.- Returns:
- the value of the
durationrecord 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
-