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 Details

    • Builder

      public Builder(SimulationThreatKind kind, int id, Coord position, int startTick, int duration, int radius, int penalty)
      Creates an instance of a Builder record class.
      Parameters:
      kind - the value for the kind record component
      id - the value for the id record component
      position - the value for the position record component
      startTick - the value for the startTick record component
      duration - the value for the duration record component
      radius - the value for the radius record component
      penalty - the value for the penalty record component
  • Method Details

    • kind

      Sets the source kind.
      Parameters:
      kind - broad source category
    • id

      public SimulationThreat.Builder id(int id)
      Sets the source id.
      Parameters:
      id - source id
    • active

      public SimulationThreat.Builder active(int startTick, int duration)
      Sets the active tick range.
      Parameters:
      startTick - first simulated tick when this hazard is active
      duration - number of simulated ticks this hazard remains active
    • always

      public SimulationThreat.Builder always()
      Marks this threat as active for the full simulation horizon.
    • radius

      public SimulationThreat.Builder radius(int radius)
      Sets the Chebyshev radius around the threat coordinate.
      Parameters:
      radius - radius around the threat coordinate
    • penalty

      public SimulationThreat.Builder penalty(int penalty)
      Sets the penalty added to matching nodes.
      Parameters:
      penalty - penalty amount
    • penalize

      public SimulationThreat penalize()
      Builds a threat that penalizes matching nodes without rejecting them as final destinations.
    • avoid

      public SimulationThreat avoid()
      Builds a threat that should be avoided as a final destination.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • kind

      public SimulationThreatKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • position

      public Coord position()
      Returns the value of the position record component.
      Returns:
      the value of the position record component
    • startTick

      public int startTick()
      Returns the value of the startTick record component.
      Returns:
      the value of the startTick record component
    • duration

      public int duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • radius

      public int radius()
      Returns the value of the radius record component.
      Returns:
      the value of the radius record component
    • penalty

      public int penalty()
      Returns the value of the penalty record component.
      Returns:
      the value of the penalty record component