Package net.bmahe.genetics4j.core.spec
Class ImmutableGenotypeFitness<T>
java.lang.Object
net.bmahe.genetics4j.core.spec.ImmutableGenotypeFitness<T>
- All Implemented Interfaces:
GenotypeFitness<T>
@Generated(from="GenotypeFitness",
generator="Immutables")
@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().
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableGenotypeFitness(Genotype genotype, T fitness) privateImmutableGenotypeFitness(ImmutableGenotypeFitness<T> original, Genotype genotype, T fitness) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ImmutableGenotypeFitness.Builder<T> builder()Creates a builder forGenotypeFitness.static <T> GenotypeFitness<T> copyOf(GenotypeFitness<T> instance) Creates an immutable copy of aGenotypeFitnessvalue.booleanThis instance is equal to all instances ofImmutableGenotypeFitnessthat have equal attribute values.private booleanequalsByValue(ImmutableGenotypeFitness<?> another) fitness()genotype()inthashCode()Computes a hash code from attributes:genotype,fitness.static <T> GenotypeFitness<T> Construct a new immutableGenotypeFitnessinstance.toString()Prints the immutable valueGenotypeFitnesswith attribute values.final ImmutableGenotypeFitness<T> withFitness(T value) Copy the current immutable object by setting a value for thefitnessattribute.final ImmutableGenotypeFitness<T> withGenotype(Genotype value) Copy the current immutable object by setting a value for thegenotypeattribute.
-
Field Details
-
genotype
-
fitness
-
-
Constructor Details
-
ImmutableGenotypeFitness
-
ImmutableGenotypeFitness
private ImmutableGenotypeFitness(ImmutableGenotypeFitness<T> original, Genotype genotype, T fitness)
-
-
Method Details
-
genotype
- Specified by:
genotypein interfaceGenotypeFitness<T>- Returns:
- The value of the
genotypeattribute
-
fitness
- Specified by:
fitnessin interfaceGenotypeFitness<T>- Returns:
- The value of the
fitnessattribute
-
withGenotype
Copy the current immutable object by setting a value for thegenotypeattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for genotype- Returns:
- A modified copy or the
thisobject
-
withFitness
Copy the current immutable object by setting a value for thefitnessattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for fitness- Returns:
- A modified copy or the
thisobject
-
equals
This instance is equal to all instances ofImmutableGenotypeFitnessthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:genotype,fitness. -
toString
Prints the immutable valueGenotypeFitnesswith attribute values. -
of
Construct a new immutableGenotypeFitnessinstance.- Type Parameters:
T- generic parameter T- Parameters:
genotype- The value for thegenotypeattributefitness- The value for thefitnessattribute- Returns:
- An immutable GenotypeFitness instance
-
copyOf
Creates an immutable copy of aGenotypeFitnessvalue. 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
Creates a builder forGenotypeFitness.ImmutableGenotypeFitness.<T>builder() .genotype(net.bmahe.genetics4j.core.Genotype) // requiredgenotype.fitness(T) // requiredfitness.build();- Type Parameters:
T- generic parameter T- Returns:
- A new GenotypeFitness builder
-