Class ImmutableBitChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.BitChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableBitChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableBitChromosomeSpec
extends BitChromosomeSpec
Immutable implementation of
BitChromosomeSpec
.
Use the builder to create immutable instances:
ImmutableBitChromosomeSpec.builder()
.
Use the static factory method to create immutable instances:
ImmutableBitChromosomeSpec.of()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builds instances of typeImmutableBitChromosomeSpec
. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a builder forImmutableBitChromosomeSpec
.static ImmutableBitChromosomeSpec
copyOf
(BitChromosomeSpec instance) Creates an immutable copy of aBitChromosomeSpec
value.boolean
This instance is equal to all instances ofImmutableBitChromosomeSpec
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableBitChromosomeSpec another) int
hashCode()
Computes a hash code from attributes:numBits
.int
numBits()
static ImmutableBitChromosomeSpec
of
(int numBits) Construct a new immutableBitChromosomeSpec
instance.toString()
Prints the immutable valueBitChromosomeSpec
with attribute values.private static ImmutableBitChromosomeSpec
validate
(ImmutableBitChromosomeSpec instance) withNumBits
(int value) Copy the current immutable object by setting a value for thenumBits
attribute.Methods inherited from class net.bmahe.genetics4j.core.spec.chromosome.BitChromosomeSpec
check
-
Field Details
-
numBits
private final int numBits
-
-
Constructor Details
-
ImmutableBitChromosomeSpec
private ImmutableBitChromosomeSpec(int numBits)
-
-
Method Details
-
numBits
public int numBits()- Specified by:
numBits
in classBitChromosomeSpec
- Returns:
- The value of the
numBits
attribute
-
withNumBits
Copy the current immutable object by setting a value for thenumBits
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for numBits- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableBitChromosomeSpec
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:numBits
. -
toString
Prints the immutable valueBitChromosomeSpec
with attribute values. -
of
Construct a new immutableBitChromosomeSpec
instance.- Parameters:
numBits
- The value for thenumBits
attribute- Returns:
- An immutable BitChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aBitChromosomeSpec
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 BitChromosomeSpec instance
-
builder
Creates a builder forImmutableBitChromosomeSpec
.ImmutableBitChromosomeSpec.builder() .numBits(int) // required
numBits
.build();- Returns:
- A new ImmutableBitChromosomeSpec builder
-