Record Class AreaPreference.ScoreBuilder<I>
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.rules.preference.AreaPreference.ScoreBuilder<I>
- Type Parameters:
I- plugin-defined input for each run- Record Components:
areas- function that supplies preferred areas for the current inputscore- score added at distance zero
- Enclosing class:
AreaPreference
public static record AreaPreference.ScoreBuilder<I>(Function<I,? extends Collection<Rect>> areas, int score)
extends Record
Builder for area preference scoring after a base score has been set.
-
Constructor Summary
ConstructorsConstructorDescriptionScoreBuilder(Function<I, ? extends Collection<Rect>> areas, int score) Creates an instance of aScoreBuilderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionFunction<I, ? extends Collection<Rect>> areas()Returns the value of theareasrecord component.distancePenalty(int distancePenalty) Builds an area preference task.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intscore()Returns the value of thescorerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
distancePenalty
Builds an area preference task.- Parameters:
distancePenalty- score subtracted per tile away from the nearest area
-
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 '=='. -
areas
Returns the value of theareasrecord component.- Returns:
- the value of the
areasrecord component
-
score
public int score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-