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("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
Modifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableGenotypeFitness
. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableGenotypeFitness
(Genotype genotype, T fitness) private
ImmutableGenotypeFitness
(ImmutableGenotypeFitness<T> original, Genotype genotype, T fitness) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ImmutableGenotypeFitness.Builder
<T> builder()
Creates a builder forImmutableGenotypeFitness
.static <T> ImmutableGenotypeFitness
<T> copyOf
(GenotypeFitness<T> instance) Creates an immutable copy of aGenotypeFitness
value.boolean
This instance is equal to all instances ofImmutableGenotypeFitness
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableGenotypeFitness<?> another) fitness()
genotype()
int
hashCode()
Computes a hash code from attributes:genotype
,fitness
.static <T> ImmutableGenotypeFitness
<T> Construct a new immutableGenotypeFitness
instance.toString()
Prints the immutable valueGenotypeFitness
with attribute values.final ImmutableGenotypeFitness
<T> withFitness
(T value) Copy the current immutable object by setting a value for thefitness
attribute.final ImmutableGenotypeFitness
<T> withGenotype
(Genotype value) Copy the current immutable object by setting a value for thegenotype
attribute.
-
Field Details
-
genotype
-
fitness
-
-
Constructor Details
-
ImmutableGenotypeFitness
-
ImmutableGenotypeFitness
private ImmutableGenotypeFitness(ImmutableGenotypeFitness<T> original, Genotype genotype, T fitness)
-
-
Method Details
-
genotype
- Specified by:
genotype
in interfaceGenotypeFitness<T>
- Returns:
- The value of the
genotype
attribute
-
fitness
- Specified by:
fitness
in interfaceGenotypeFitness<T>
- Returns:
- The value of the
fitness
attribute
-
withGenotype
Copy the current immutable object by setting a value for thegenotype
attribute. 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 of the
this
object
-
withFitness
Copy the current immutable object by setting a value for thefitness
attribute. 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 of the
this
object
-
equals
This instance is equal to all instances ofImmutableGenotypeFitness
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:genotype
,fitness
. -
toString
Prints the immutable valueGenotypeFitness
with attribute values. -
of
Construct a new immutableGenotypeFitness
instance.- Type Parameters:
T
- generic parameter T- Parameters:
genotype
- The value for thegenotype
attributefitness
- The value for thefitness
attribute- Returns:
- An immutable GenotypeFitness instance
-
copyOf
Creates an immutable copy of aGenotypeFitness
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
Creates a builder forImmutableGenotypeFitness
.ImmutableGenotypeFitness.<T>builder() .genotype(net.bmahe.genetics4j.core.Genotype) // required
genotype
.fitness(T) // requiredfitness
.build();- Type Parameters:
T
- generic parameter T- Returns:
- A new ImmutableGenotypeFitness builder
-