Class ImmutableRule
java.lang.Object
net.bmahe.genetics4j.gp.spec.mutation.ImmutableRule
- All Implemented Interfaces:
Rule
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableRule
extends Object
implements Rule
Immutable implementation of
Rule
.
Use the builder to create immutable instances:
ImmutableRule.builder()
.
Use the static factory method to create immutable instances:
ImmutableRule.of()
.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableRule
(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) private
ImmutableRule
(ImmutableRule original, Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableRule.Builder
builder()
Creates a builder forImmutableRule
.static ImmutableRule
Creates an immutable copy of aRule
value.boolean
This instance is equal to all instances ofImmutableRule
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableRule another) int
hashCode()
Computes a hash code from attributes:predicate
,applicator
.static ImmutableRule
of
(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Construct a new immutableRule
instance.toString()
Prints the immutable valueRule
with attribute values.final ImmutableRule
withApplicator
(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for theapplicator
attribute.final ImmutableRule
withPredicate
(Predicate<TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for thepredicate
attribute.
-
Field Details
-
predicate
-
applicator
-
-
Constructor Details
-
ImmutableRule
-
ImmutableRule
private ImmutableRule(ImmutableRule original, Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator)
-
-
Method Details
-
predicate
-
applicator
- Specified by:
applicator
in interfaceRule
- Returns:
- The value of the
applicator
attribute
-
withPredicate
Copy the current immutable object by setting a value for thepredicate
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for predicate- Returns:
- A modified copy of the
this
object
-
withApplicator
public final ImmutableRule withApplicator(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for theapplicator
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for applicator- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableRule
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:predicate
,applicator
. -
toString
Prints the immutable valueRule
with attribute values. -
of
public static ImmutableRule of(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Construct a new immutableRule
instance.- Parameters:
predicate
- The value for thepredicate
attributeapplicator
- The value for theapplicator
attribute- Returns:
- An immutable Rule instance
-
copyOf
Creates an immutable copy of aRule
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 Rule instance
-
builder
Creates a builder forImmutableRule
.ImmutableRule.builder() .predicate(function.Predicate<net.bmahe.genetics4j.core.chromosomes.TreeNode<net.bmahe.genetics4j.gp.Operation<?>>>) // required
predicate
.applicator(function.BiFunction<net.bmahe.genetics4j.gp.program.Program, net.bmahe.genetics4j.core.chromosomes.TreeNode<net.bmahe.genetics4j.gp.Operation<?>>, net.bmahe.genetics4j.core.chromosomes.TreeNode<net.bmahe.genetics4j.gp.Operation<?>>>) // requiredapplicator
.build();- Returns:
- A new ImmutableRule builder
-