Class ImmutableGenotypeFitness<T>

java.lang.Object
net.bmahe.genetics4j.core.spec.ImmutableGenotypeFitness<T>
All Implemented Interfaces:
GenotypeFitness<T>

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableGenotypeFitness<T> extends Object implements GenotypeFitness<T>
Immutable implementation of GenotypeFitness.

Use the builder to create immutable instances: ImmutableGenotypeFitness.builder(). Use the static factory method to create immutable instances: ImmutableGenotypeFitness.of().

  • Field Details

    • genotype

      private final Genotype genotype
    • fitness

      private final T fitness
  • Constructor Details

    • ImmutableGenotypeFitness

      private ImmutableGenotypeFitness(Genotype genotype, T fitness)
    • ImmutableGenotypeFitness

      private ImmutableGenotypeFitness(ImmutableGenotypeFitness<T> original, Genotype genotype, T fitness)
  • Method Details

    • genotype

      public Genotype genotype()
      Specified by:
      genotype in interface GenotypeFitness<T>
      Returns:
      The value of the genotype attribute
    • fitness

      public T fitness()
      Specified by:
      fitness in interface GenotypeFitness<T>
      Returns:
      The value of the fitness attribute
    • withGenotype

      public final ImmutableGenotypeFitness<T> withGenotype(Genotype value)
      Copy the current immutable object by setting a value for the genotype attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for genotype
      Returns:
      A modified copy of the this object
    • withFitness

      public final ImmutableGenotypeFitness<T> withFitness(T value)
      Copy the current immutable object by setting a value for the fitness attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fitness
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableGenotypeFitness that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableGenotypeFitness<?> another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: genotype, fitness.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value GenotypeFitness with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static <T> ImmutableGenotypeFitness<T> of(Genotype genotype, T fitness)
      Construct a new immutable GenotypeFitness instance.
      Type Parameters:
      T - generic parameter T
      Parameters:
      genotype - The value for the genotype attribute
      fitness - The value for the fitness attribute
      Returns:
      An immutable GenotypeFitness instance
    • copyOf

      public static <T> ImmutableGenotypeFitness<T> copyOf(GenotypeFitness<T> instance)
      Creates an immutable copy of a GenotypeFitness value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      T - generic parameter T
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable GenotypeFitness instance
    • builder

      public static <T> ImmutableGenotypeFitness.Builder<T> builder()
      Creates a builder for ImmutableGenotypeFitness.
       ImmutableGenotypeFitness.&lt;T&gt;builder()
          .genotype(net.bmahe.genetics4j.core.Genotype) // required genotype
          .fitness(T) // required fitness
          .build();
       
      Type Parameters:
      T - generic parameter T
      Returns:
      A new ImmutableGenotypeFitness builder