Record Class AreaPreference.Builder<I>
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.rules.preference.AreaPreference.Builder<I>
- Type Parameters:
I- plugin-defined input for each run- Record Components:
areas- function that supplies preferred areas for the current input
- Enclosing class:
AreaPreference
public static record AreaPreference.Builder<I>(Function<I,? extends Collection<Rect>> areas)
extends Record
Builder for area preference scoring.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(Function<I, ? extends Collection<Rect>> areas) Creates an instance of aBuilderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionFunction<I, ? extends Collection<Rect>> areas()Returns the value of theareasrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.score(int score) Sets the score added for nodes inside the preferred area.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Builder
Creates an instance of aBuilderrecord class.- Parameters:
areas- the value for theareasrecord component
-
-
Method Details
-
score
Sets the score added for nodes inside the preferred area.- Parameters:
score- score added at distance zero
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
areas
Returns the value of theareasrecord component.- Returns:
- the value of the
areasrecord component
-