Class ImmutableFloatChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.FloatChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableFloatChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated(from="FloatChromosomeSpec",
generator="Immutables")
@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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Distributionprivate final floatprivate final floatprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableFloatChromosomeSpec(int size, float minValue, float maxValue) privateImmutableFloatChromosomeSpec(int size, float minValue, float maxValue, Distribution distribution) private -
Method Summary
Modifier and TypeMethodDescriptionstatic FloatChromosomeSpeccopyOf(FloatChromosomeSpec instance) Creates an immutable copy of aFloatChromosomeSpecvalue.booleanThis instance is equal to all instances ofImmutableFloatChromosomeSpecthat have equal attribute values.private booleaninthashCode()Computes a hash code from attributes:size,minValue,maxValue,distribution.floatmaxValue()floatminValue()static FloatChromosomeSpecof(int size, float minValue, float maxValue) Construct a new immutableFloatChromosomeSpecinstance.intsize()toString()Prints the immutable valueFloatChromosomeSpecwith attribute values.private static ImmutableFloatChromosomeSpecvalidate(ImmutableFloatChromosomeSpec instance) withDistribution(Distribution value) Copy the current immutable object by setting a value for thedistributionattribute.withMaxValue(float value) Copy the current immutable object by setting a value for themaxValueattribute.withMinValue(float value) Copy the current immutable object by setting a value for theminValueattribute.withSize(int value) Copy the current immutable object by setting a value for thesizeattribute.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:
sizein classFloatChromosomeSpec- Returns:
- The value of the
sizeattribute
-
minValue
public float minValue()- Specified by:
minValuein classFloatChromosomeSpec- Returns:
- The value of the
minValueattribute
-
maxValue
public float maxValue()- Specified by:
maxValuein classFloatChromosomeSpec- Returns:
- The value of the
maxValueattribute
-
distribution
- Overrides:
distributionin classFloatChromosomeSpec- Returns:
- The value of the
distributionattribute
-
withSize
Copy the current immutable object by setting a value for thesizeattribute. 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 or the
thisobject
-
withMinValue
Copy the current immutable object by setting a value for theminValueattribute. 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 or the
thisobject
-
withMaxValue
Copy the current immutable object by setting a value for themaxValueattribute. 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 or the
thisobject
-
withDistribution
Copy the current immutable object by setting a value for thedistributionattribute. 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutableFloatChromosomeSpecthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:size,minValue,maxValue,distribution. -
toString
Prints the immutable valueFloatChromosomeSpecwith attribute values. -
of
Construct a new immutableFloatChromosomeSpecinstance.- Parameters:
size- The value for thesizeattributeminValue- The value for theminValueattributemaxValue- The value for themaxValueattribute- Returns:
- An immutable FloatChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aFloatChromosomeSpecvalue. 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
-