Class ImmutableFloatChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.FloatChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableFloatChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableFloatChromosomeSpec
extends FloatChromosomeSpec
Immutable implementation of
FloatChromosomeSpec
.
Use the builder to create immutable instances:
new FloatChromosomeSpec.Builder()
.
Use the static factory method to create immutable instances:
ImmutableFloatChromosomeSpec.of()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builds instances of typeImmutableFloatChromosomeSpec
. -
Field Summary
Modifier and TypeFieldDescriptionprivate final Distribution
private final float
private final float
private final int
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableFloatChromosomeSpec
(int size, float minValue, float maxValue) private
ImmutableFloatChromosomeSpec
(int size, float minValue, float maxValue, Distribution distribution) private
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableFloatChromosomeSpec
copyOf
(FloatChromosomeSpec instance) Creates an immutable copy of aFloatChromosomeSpec
value.boolean
This instance is equal to all instances ofImmutableFloatChromosomeSpec
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableFloatChromosomeSpec another) int
hashCode()
Computes a hash code from attributes:size
,minValue
,maxValue
,distribution
.float
maxValue()
float
minValue()
static ImmutableFloatChromosomeSpec
of
(int size, float minValue, float maxValue) Construct a new immutableFloatChromosomeSpec
instance.int
size()
toString()
Prints the immutable valueFloatChromosomeSpec
with attribute values.private static ImmutableFloatChromosomeSpec
validate
(ImmutableFloatChromosomeSpec instance) withDistribution
(Distribution value) Copy the current immutable object by setting a value for thedistribution
attribute.withMaxValue
(float value) Copy the current immutable object by setting a value for themaxValue
attribute.withMinValue
(float 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.FloatChromosomeSpec
check, of
-
Field Details
-
size
private final int size -
minValue
private final float minValue -
maxValue
private final float maxValue -
distribution
-
-
Constructor Details
-
ImmutableFloatChromosomeSpec
private ImmutableFloatChromosomeSpec(int size, float minValue, float maxValue) -
ImmutableFloatChromosomeSpec
-
ImmutableFloatChromosomeSpec
private ImmutableFloatChromosomeSpec(int size, float minValue, float maxValue, Distribution distribution)
-
-
Method Details
-
size
public int size()- Specified by:
size
in classFloatChromosomeSpec
- Returns:
- The value of the
size
attribute
-
minValue
public float minValue()- Specified by:
minValue
in classFloatChromosomeSpec
- Returns:
- The value of the
minValue
attribute
-
maxValue
public float maxValue()- Specified by:
maxValue
in classFloatChromosomeSpec
- Returns:
- The value of the
maxValue
attribute
-
distribution
- Overrides:
distribution
in classFloatChromosomeSpec
- 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 ofImmutableFloatChromosomeSpec
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:size
,minValue
,maxValue
,distribution
. -
toString
Prints the immutable valueFloatChromosomeSpec
with attribute values. -
of
Construct a new immutableFloatChromosomeSpec
instance.- Parameters:
size
- The value for thesize
attributeminValue
- The value for theminValue
attributemaxValue
- The value for themaxValue
attribute- Returns:
- An immutable FloatChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aFloatChromosomeSpec
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 FloatChromosomeSpec instance
-