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