Record Class SimulationAreaThreat.Builder
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.threat.SimulationAreaThreat.Builder
- Enclosing class:
SimulationAreaThreat
public static record SimulationAreaThreat.Builder(int id, Rect area, int startTick, int duration, int penalty)
extends Record
Builder for rectangular area threats.
-
Constructor Summary
Constructors -
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.area()Returns the value of thearearecord component.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.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.intReturns the value of thestartTickrecord component.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 componentarea- the value for thearearecord componentstartTick- the value for thestartTickrecord componentduration- the value for thedurationrecord componentpenalty- the value for thepenaltyrecord component
-
-
Method Details
-
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. -
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
-
area
Returns the value of thearearecord component.- Returns:
- the value of the
arearecord 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
-
penalty
public int penalty()Returns the value of thepenaltyrecord component.- Returns:
- the value of the
penaltyrecord component
-