Class ImmutableTarpeianMethod
java.lang.Object
net.bmahe.genetics4j.gp.postevaluationprocess.TarpeianMethod
net.bmahe.genetics4j.gp.postevaluationprocess.ImmutableTarpeianMethod
- All Implemented Interfaces:
PostEvaluationProcessor<Double>
@Generated(from="TarpeianMethod",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableTarpeianMethod
extends TarpeianMethod
Immutable implementation of
TarpeianMethod.
Use the builder to create immutable instances:
ImmutableTarpeianMethod.builder().
Use the static factory method to create immutable instances:
ImmutableTarpeianMethod.of().
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleprivate final doubleprivate final RandomGenerator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableTarpeianMethod(RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue) privateImmutableTarpeianMethod(ImmutableTarpeianMethod original, RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forTarpeianMethod.static TarpeianMethodcopyOf(TarpeianMethod instance) Creates an immutable copy of aTarpeianMethodvalue.booleanThis instance is equal to all instances ofImmutableTarpeianMethodthat have equal attribute values.private booleanequalsByValue(ImmutableTarpeianMethod another) inthashCode()Computes a hash code from attributes:randomGenerator,sizeFunction,probability,newValue.doublenewValue()static TarpeianMethodof(RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue) Construct a new immutableTarpeianMethodinstance.doubletoString()Prints the immutable valueTarpeianMethodwith attribute values.private static ImmutableTarpeianMethodvalidate(ImmutableTarpeianMethod instance) final ImmutableTarpeianMethodwithNewValue(double value) Copy the current immutable object by setting a value for thenewValueattribute.final ImmutableTarpeianMethodwithProbability(double value) Copy the current immutable object by setting a value for theprobabilityattribute.final ImmutableTarpeianMethodCopy the current immutable object by setting a value for therandomGeneratorattribute.final ImmutableTarpeianMethodwithSizeFunction(Function<Genotype, Integer> value) Copy the current immutable object by setting a value for thesizeFunctionattribute.Methods inherited from class net.bmahe.genetics4j.gp.postevaluationprocess.TarpeianMethod
apply, check, ofTreeChromosome
-
Field Details
-
randomGenerator
-
sizeFunction
-
probability
private final double probability -
newValue
private final double newValue
-
-
Constructor Details
-
ImmutableTarpeianMethod
private ImmutableTarpeianMethod(RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue) -
ImmutableTarpeianMethod
private ImmutableTarpeianMethod(ImmutableTarpeianMethod original, RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue)
-
-
Method Details
-
randomGenerator
- Specified by:
randomGeneratorin classTarpeianMethod- Returns:
- The value of the
randomGeneratorattribute
-
sizeFunction
- Specified by:
sizeFunctionin classTarpeianMethod- Returns:
- The value of the
sizeFunctionattribute
-
probability
public double probability()- Specified by:
probabilityin classTarpeianMethod- Returns:
- The value of the
probabilityattribute
-
newValue
public double newValue()- Specified by:
newValuein classTarpeianMethod- Returns:
- The value of the
newValueattribute
-
withRandomGenerator
Copy the current immutable object by setting a value for therandomGeneratorattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for randomGenerator- Returns:
- A modified copy or the
thisobject
-
withSizeFunction
Copy the current immutable object by setting a value for thesizeFunctionattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sizeFunction- Returns:
- A modified copy or the
thisobject
-
withProbability
Copy the current immutable object by setting a value for theprobabilityattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for probability- Returns:
- A modified copy or the
thisobject
-
withNewValue
Copy the current immutable object by setting a value for thenewValueattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for newValue- Returns:
- A modified copy or the
thisobject
-
equals
This instance is equal to all instances ofImmutableTarpeianMethodthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:randomGenerator,sizeFunction,probability,newValue. -
toString
Prints the immutable valueTarpeianMethodwith attribute values. -
of
public static TarpeianMethod of(RandomGenerator randomGenerator, Function<Genotype, Integer> sizeFunction, double probability, double newValue) Construct a new immutableTarpeianMethodinstance.- Parameters:
randomGenerator- The value for therandomGeneratorattributesizeFunction- The value for thesizeFunctionattributeprobability- The value for theprobabilityattributenewValue- The value for thenewValueattribute- Returns:
- An immutable TarpeianMethod instance
-
validate
-
copyOf
Creates an immutable copy of aTarpeianMethodvalue. 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 TarpeianMethod instance
-
builder
Creates a builder forTarpeianMethod.ImmutableTarpeianMethod.builder() .randomGenerator(random.RandomGenerator) // requiredrandomGenerator.sizeFunction(function.Function<net.bmahe.genetics4j.core.Genotype, Integer>) // requiredsizeFunction.probability(double) // requiredprobability.newValue(double) // requirednewValue.build();- Returns:
- A new TarpeianMethod builder
-