Class ImmutableTarpeianMethod.Builder

java.lang.Object
net.bmahe.genetics4j.gp.postevaluationprocess.ImmutableTarpeianMethod.Builder
Enclosing class:
ImmutableTarpeianMethod

public static final class ImmutableTarpeianMethod.Builder extends Object
Builds instances of type ImmutableTarpeianMethod. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Field Details

    • INIT_BIT_RANDOM_GENERATOR

      private static final long INIT_BIT_RANDOM_GENERATOR
      See Also:
    • INIT_BIT_SIZE_FUNCTION

      private static final long INIT_BIT_SIZE_FUNCTION
      See Also:
    • INIT_BIT_PROBABILITY

      private static final long INIT_BIT_PROBABILITY
      See Also:
    • INIT_BIT_NEW_VALUE

      private static final long INIT_BIT_NEW_VALUE
      See Also:
    • initBits

      private long initBits
    • randomGenerator

      private RandomGenerator randomGenerator
    • sizeFunction

      private Function<Genotype,Integer> sizeFunction
    • probability

      private double probability
    • newValue

      private double newValue
  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • from

      public final ImmutableTarpeianMethod.Builder from(TarpeianMethod instance)
      Fill a builder with attribute values from the provided TarpeianMethod instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • randomGenerator

      public final ImmutableTarpeianMethod.Builder randomGenerator(RandomGenerator randomGenerator)
      Initializes the value for the randomGenerator attribute.
      Parameters:
      randomGenerator - The value for randomGenerator
      Returns:
      this builder for use in a chained invocation
    • sizeFunction

      public final ImmutableTarpeianMethod.Builder sizeFunction(Function<Genotype,Integer> sizeFunction)
      Initializes the value for the sizeFunction attribute.
      Parameters:
      sizeFunction - The value for sizeFunction
      Returns:
      this builder for use in a chained invocation
    • probability

      public final ImmutableTarpeianMethod.Builder probability(double probability)
      Initializes the value for the probability attribute.
      Parameters:
      probability - The value for probability
      Returns:
      this builder for use in a chained invocation
    • newValue

      public final ImmutableTarpeianMethod.Builder newValue(double newValue)
      Initializes the value for the newValue attribute.
      Parameters:
      newValue - The value for newValue
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableTarpeianMethod build()
      Returns:
      An immutable instance of TarpeianMethod
      Throws:
      IllegalStateException - if any required attributes are missing
    • formatRequiredAttributesMessage

      private String formatRequiredAttributesMessage()