Class ImmutablePartialMutation
java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.PartialMutation
net.bmahe.genetics4j.core.spec.mutation.ImmutablePartialMutation
- All Implemented Interfaces:
MutationPolicy
@Generated(from="PartialMutation",
generator="Immutables")
@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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutablePartialMutation(int chromosomeIndex, MutationPolicy mutationPolicy) privateImmutablePartialMutation(ImmutablePartialMutation original, int chromosomeIndex, MutationPolicy mutationPolicy) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forPartialMutation.intstatic PartialMutationcopyOf(PartialMutation instance) Creates an immutable copy of aPartialMutationvalue.booleanThis instance is equal to all instances ofImmutablePartialMutationthat have equal attribute values.private booleanequalsByValue(ImmutablePartialMutation another) inthashCode()Computes a hash code from attributes:chromosomeIndex,mutationPolicy.static PartialMutationof(int chromosomeIndex, MutationPolicy mutationPolicy) Construct a new immutablePartialMutationinstance.toString()Prints the immutable valuePartialMutationwith attribute values.private static ImmutablePartialMutationvalidate(ImmutablePartialMutation instance) final ImmutablePartialMutationwithChromosomeIndex(int value) Copy the current immutable object by setting a value for thechromosomeIndexattribute.final ImmutablePartialMutationwithMutationPolicy(MutationPolicy value) Copy the current immutable object by setting a value for themutationPolicyattribute.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:
chromosomeIndexin classPartialMutation- Returns:
- The value of the
chromosomeIndexattribute
-
mutationPolicy
- Specified by:
mutationPolicyin classPartialMutation- Returns:
- The value of the
mutationPolicyattribute
-
withChromosomeIndex
Copy the current immutable object by setting a value for thechromosomeIndexattribute. 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 or the
thisobject
-
withMutationPolicy
Copy the current immutable object by setting a value for themutationPolicyattribute. 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutablePartialMutationthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:chromosomeIndex,mutationPolicy. -
toString
Prints the immutable valuePartialMutationwith attribute values. -
of
Construct a new immutablePartialMutationinstance.- Parameters:
chromosomeIndex- The value for thechromosomeIndexattributemutationPolicy- The value for themutationPolicyattribute- Returns:
- An immutable PartialMutation instance
-
validate
-
copyOf
Creates an immutable copy of aPartialMutationvalue. 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 forPartialMutation.ImmutablePartialMutation.builder() .chromosomeIndex(int) // requiredchromosomeIndex.mutationPolicy(net.bmahe.genetics4j.core.spec.mutation.MutationPolicy) // requiredmutationPolicy.build();- Returns:
- A new PartialMutation builder
-