Class ImmutablePartialMutation
java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.PartialMutation
net.bmahe.genetics4j.core.spec.mutation.ImmutablePartialMutation
- All Implemented Interfaces:
MutationPolicy
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutablePartialMutation
extends PartialMutation
Immutable implementation of
PartialMutation
.
Use the builder to create immutable instances:
ImmutablePartialMutation.builder()
.
Use the static factory method to create immutable instances:
ImmutablePartialMutation.of()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutablePartialMutation
. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutablePartialMutation
(int chromosomeIndex, MutationPolicy mutationPolicy) private
ImmutablePartialMutation
(ImmutablePartialMutation original, int chromosomeIndex, MutationPolicy mutationPolicy) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutablePartialMutation
.int
static ImmutablePartialMutation
copyOf
(PartialMutation instance) Creates an immutable copy of aPartialMutation
value.boolean
This instance is equal to all instances ofImmutablePartialMutation
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutablePartialMutation another) int
hashCode()
Computes a hash code from attributes:chromosomeIndex
,mutationPolicy
.static ImmutablePartialMutation
of
(int chromosomeIndex, MutationPolicy mutationPolicy) Construct a new immutablePartialMutation
instance.toString()
Prints the immutable valuePartialMutation
with attribute values.private static ImmutablePartialMutation
validate
(ImmutablePartialMutation instance) final ImmutablePartialMutation
withChromosomeIndex
(int value) Copy the current immutable object by setting a value for thechromosomeIndex
attribute.final ImmutablePartialMutation
withMutationPolicy
(MutationPolicy value) Copy the current immutable object by setting a value for themutationPolicy
attribute.Methods inherited from class net.bmahe.genetics4j.core.spec.mutation.PartialMutation
check
-
Field Details
-
chromosomeIndex
private final int chromosomeIndex -
mutationPolicy
-
-
Constructor Details
-
ImmutablePartialMutation
-
ImmutablePartialMutation
private ImmutablePartialMutation(ImmutablePartialMutation original, int chromosomeIndex, MutationPolicy mutationPolicy)
-
-
Method Details
-
chromosomeIndex
public int chromosomeIndex()- Specified by:
chromosomeIndex
in classPartialMutation
- Returns:
- The value of the
chromosomeIndex
attribute
-
mutationPolicy
- Specified by:
mutationPolicy
in classPartialMutation
- Returns:
- The value of the
mutationPolicy
attribute
-
withChromosomeIndex
Copy the current immutable object by setting a value for thechromosomeIndex
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for chromosomeIndex- Returns:
- A modified copy of the
this
object
-
withMutationPolicy
Copy the current immutable object by setting a value for themutationPolicy
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for mutationPolicy- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutablePartialMutation
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:chromosomeIndex
,mutationPolicy
. -
toString
Prints the immutable valuePartialMutation
with attribute values. -
of
Construct a new immutablePartialMutation
instance.- Parameters:
chromosomeIndex
- The value for thechromosomeIndex
attributemutationPolicy
- The value for themutationPolicy
attribute- Returns:
- An immutable PartialMutation instance
-
validate
-
copyOf
Creates an immutable copy of aPartialMutation
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable PartialMutation instance
-
builder
Creates a builder forImmutablePartialMutation
.ImmutablePartialMutation.builder() .chromosomeIndex(int) // required
chromosomeIndex
.mutationPolicy(net.bmahe.genetics4j.core.spec.mutation.MutationPolicy) // requiredmutationPolicy
.build();- Returns:
- A new ImmutablePartialMutation builder
-