Class ImmutableDoubleChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.DoubleChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableDoubleChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated(from="DoubleChromosomeSpec",
generator="Immutables")
@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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Distributionprivate final doubleprivate final doubleprivate final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableDoubleChromosomeSpec(int size, double minValue, double maxValue) privateImmutableDoubleChromosomeSpec(int size, double minValue, double maxValue, Distribution distribution) private -
Method Summary
Modifier and TypeMethodDescriptionstatic DoubleChromosomeSpeccopyOf(DoubleChromosomeSpec instance) Creates an immutable copy of aDoubleChromosomeSpecvalue.booleanThis instance is equal to all instances ofImmutableDoubleChromosomeSpecthat have equal attribute values.private booleaninthashCode()Computes a hash code from attributes:size,minValue,maxValue,distribution.doublemaxValue()doubleminValue()static DoubleChromosomeSpecof(int size, double minValue, double maxValue) Construct a new immutableDoubleChromosomeSpecinstance.intsize()toString()Prints the immutable valueDoubleChromosomeSpecwith attribute values.private static ImmutableDoubleChromosomeSpecvalidate(ImmutableDoubleChromosomeSpec instance) withDistribution(Distribution value) Copy the current immutable object by setting a value for thedistributionattribute.withMaxValue(double value) Copy the current immutable object by setting a value for themaxValueattribute.withMinValue(double 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.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:
sizein classDoubleChromosomeSpec- Returns:
- The value of the
sizeattribute
-
minValue
public double minValue()- Specified by:
minValuein classDoubleChromosomeSpec- Returns:
- The value of the
minValueattribute
-
maxValue
public double maxValue()- Specified by:
maxValuein classDoubleChromosomeSpec- Returns:
- The value of the
maxValueattribute
-
distribution
- Overrides:
distributionin classDoubleChromosomeSpec- 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 ofImmutableDoubleChromosomeSpecthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:size,minValue,maxValue,distribution. -
toString
Prints the immutable valueDoubleChromosomeSpecwith attribute values. -
of
Construct a new immutableDoubleChromosomeSpecinstance.- Parameters:
size- The value for thesizeattributeminValue- The value for theminValueattributemaxValue- The value for themaxValueattribute- Returns:
- An immutable DoubleChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aDoubleChromosomeSpecvalue. 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
-