Class ImmutableRepeatedMutation
java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.RepeatedMutation
net.bmahe.genetics4j.core.spec.mutation.ImmutableRepeatedMutation
- All Implemented Interfaces:
MutationPolicy
@Generated(from="RepeatedMutation",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableRepeatedMutation
extends RepeatedMutation
Immutable implementation of
RepeatedMutation.
Use the builder to create immutable instances:
new RepeatedMutation.Builder().
Use the static factory method to create immutable instances:
ImmutableRepeatedMutation.of().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final intprivate final MutationPolicy -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableRepeatedMutation(int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy) privateImmutableRepeatedMutation(ImmutableRepeatedMutation original, int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy) -
Method Summary
Modifier and TypeMethodDescriptionstatic RepeatedMutationcopyOf(RepeatedMutation instance) Creates an immutable copy of aRepeatedMutationvalue.booleanThis instance is equal to all instances ofImmutableRepeatedMutationthat have equal attribute values.private booleanequalsByValue(ImmutableRepeatedMutation another) inthashCode()Computes a hash code from attributes:minRepetitions,maxRepetitions,mutationPolicy.intintstatic RepeatedMutationof(int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy) Construct a new immutableRepeatedMutationinstance.toString()Prints the immutable valueRepeatedMutationwith attribute values.private static ImmutableRepeatedMutationvalidate(ImmutableRepeatedMutation instance) withMaxRepetitions(int value) Copy the current immutable object by setting a value for themaxRepetitionsattribute.withMinRepetitions(int value) Copy the current immutable object by setting a value for theminRepetitionsattribute.withMutationPolicy(MutationPolicy value) Copy the current immutable object by setting a value for themutationPolicyattribute.Methods inherited from class RepeatedMutation
builder, check, ofExactly, ofUpTo
-
Field Details
-
minRepetitions
private final int minRepetitions -
maxRepetitions
private final int maxRepetitions -
mutationPolicy
-
-
Constructor Details
-
ImmutableRepeatedMutation
private ImmutableRepeatedMutation(int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy) -
ImmutableRepeatedMutation
private ImmutableRepeatedMutation(ImmutableRepeatedMutation original, int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy)
-
-
Method Details
-
minRepetitions
public int minRepetitions()- Specified by:
minRepetitionsin classRepeatedMutation- Returns:
- The value of the
minRepetitionsattribute
-
maxRepetitions
public int maxRepetitions()- Specified by:
maxRepetitionsin classRepeatedMutation- Returns:
- The value of the
maxRepetitionsattribute
-
mutationPolicy
- Specified by:
mutationPolicyin classRepeatedMutation- Returns:
- The value of the
mutationPolicyattribute
-
withMinRepetitions
Copy the current immutable object by setting a value for theminRepetitionsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for minRepetitions- Returns:
- A modified copy or the
thisobject
-
withMaxRepetitions
Copy the current immutable object by setting a value for themaxRepetitionsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for maxRepetitions- 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
-
equalsByValue
-
hashCode
-
toString
-
of
public static RepeatedMutation of(int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy) Construct a new immutableRepeatedMutationinstance.- Parameters:
minRepetitions- The value for theminRepetitionsattributemaxRepetitions- The value for themaxRepetitionsattributemutationPolicy- The value for themutationPolicyattribute- Returns:
- An immutable RepeatedMutation instance
-
validate
-
copyOf
Creates an immutable copy of aRepeatedMutationvalue. 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 RepeatedMutation instance
-