Class ImmutableBitChromosomeSpec
java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.BitChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableBitChromosomeSpec
- All Implemented Interfaces:
ChromosomeSpec
@Generated(from="BitChromosomeSpec",
generator="Immutables")
@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
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forBitChromosomeSpec.static BitChromosomeSpeccopyOf(BitChromosomeSpec instance) Creates an immutable copy of aBitChromosomeSpecvalue.booleanThis instance is equal to all instances ofImmutableBitChromosomeSpecthat have equal attribute values.private booleanequalsByValue(ImmutableBitChromosomeSpec another) inthashCode()Computes a hash code from attributes:numBits.intnumBits()static BitChromosomeSpecof(int numBits) Construct a new immutableBitChromosomeSpecinstance.toString()Prints the immutable valueBitChromosomeSpecwith attribute values.private static ImmutableBitChromosomeSpecvalidate(ImmutableBitChromosomeSpec instance) withNumBits(int value) Copy the current immutable object by setting a value for thenumBitsattribute.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:
numBitsin classBitChromosomeSpec- Returns:
- The value of the
numBitsattribute
-
withNumBits
Copy the current immutable object by setting a value for thenumBitsattribute. 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutableBitChromosomeSpecthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:numBits. -
toString
Prints the immutable valueBitChromosomeSpecwith attribute values. -
of
Construct a new immutableBitChromosomeSpecinstance.- Parameters:
numBits- The value for thenumBitsattribute- Returns:
- An immutable BitChromosomeSpec instance
-
validate
-
copyOf
Creates an immutable copy of aBitChromosomeSpecvalue. 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 forBitChromosomeSpec.ImmutableBitChromosomeSpec.builder() .numBits(int) // requirednumBits.build();- Returns:
- A new BitChromosomeSpec builder
-