Class ImmutableIntChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableIntChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableIntChromosomeSpec
extends IntChromosomeSpec
Immutable implementation of
IntChromosomeSpec
.
Use the builder to create immutable instances:
new IntChromosomeSpec.Builder()
.
Use the static factory method to create immutable instances:
ImmutableIntChromosomeSpec.of()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builds instances of typeImmutableIntChromosomeSpec
. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableIntChromosomeSpec
(int size, int minValue, int maxValue) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableIntChromosomeSpec
copyOf
(IntChromosomeSpec instance) Creates an immutable copy of aIntChromosomeSpec
value.boolean
This instance is equal to all instances ofImmutableIntChromosomeSpec
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableIntChromosomeSpec another) int
hashCode()
Computes a hash code from attributes:size
,minValue
,maxValue
.int
maxValue()
int
minValue()
static ImmutableIntChromosomeSpec
of
(int size, int minValue, int maxValue) Construct a new immutableIntChromosomeSpec
instance.int
size()
toString()
Prints the immutable valueIntChromosomeSpec
with attribute values.private static ImmutableIntChromosomeSpec
validate
(ImmutableIntChromosomeSpec instance) withMaxValue
(int value) Copy the current immutable object by setting a value for themaxValue
attribute.withMinValue
(int value) Copy the current immutable object by setting a value for theminValue
attribute.withSize
(int value) Copy the current immutable object by setting a value for thesize
attribute.Methods inherited from class net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec
check
-
Field Details
-
size
private final int size -
minValue
private final int minValue -
maxValue
private final int maxValue
-
-
Constructor Details
-
ImmutableIntChromosomeSpec
private ImmutableIntChromosomeSpec(int size, int minValue, int maxValue)
-
-
Method Details
-
size
public int size()- Specified by:
size
in classIntChromosomeSpec
- Returns:
- The value of the
size
attribute
-
minValue
public int minValue()- Specified by:
minValue
in classIntChromosomeSpec
- Returns:
- The value of the
minValue
attribute
-
maxValue
public int maxValue()- Specified by:
maxValue
in classIntChromosomeSpec
- Returns:
- The value of the
maxValue
attribute
-
withSize
Copy the current immutable object by setting a value for thesize
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for size- Returns:
- A modified copy of the
this
object
-
withMinValue
Copy the current immutable object by setting a value for theminValue
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for minValue- Returns:
- A modified copy of the
this
object
-
withMaxValue
Copy the current immutable object by setting a value for themaxValue
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for maxValue- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableIntChromosomeSpec
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:size
,minValue
,maxValue
. -
toString
Prints the immutable valueIntChromosomeSpec
with attribute values. -
of
Construct a new immutableIntChromosomeSpec
instance.- Parameters:
size
- The value for thesize
attributeminValue
- The value for theminValue
attributemaxValue
- The value for themaxValue
attribute- Returns:
- An immutable IntChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aIntChromosomeSpec
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 IntChromosomeSpec instance
-