Class ImmutableRule
java.lang.Object
net.bmahe.genetics4j.gp.spec.mutation.ImmutableRule
- All Implemented Interfaces:
Rule
@Generated(from="Rule",
generator="Immutables")
@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
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableRule(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) privateImmutableRule(ImmutableRule original, Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableRule.Builderbuilder()Creates a builder forRule.static RuleCreates an immutable copy of aRulevalue.booleanThis instance is equal to all instances ofImmutableRulethat have equal attribute values.private booleanequalsByValue(ImmutableRule another) inthashCode()Computes a hash code from attributes:predicate,applicator.static Ruleof(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Construct a new immutableRuleinstance.toString()Prints the immutable valueRulewith attribute values.final ImmutableRulewithApplicator(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for theapplicatorattribute.final ImmutableRulewithPredicate(Predicate<TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for thepredicateattribute.
-
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:
applicatorin interfaceRule- Returns:
- The value of the
applicatorattribute
-
withPredicate
Copy the current immutable object by setting a value for thepredicateattribute. 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 or the
thisobject
-
withApplicator
public final ImmutableRule withApplicator(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> value) Copy the current immutable object by setting a value for theapplicatorattribute. 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutableRulethat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:predicate,applicator. -
toString
Prints the immutable valueRulewith attribute values. -
of
public static Rule of(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Construct a new immutableRuleinstance.- Parameters:
predicate- The value for thepredicateattributeapplicator- The value for theapplicatorattribute- Returns:
- An immutable Rule instance
-
copyOf
Creates an immutable copy of aRulevalue. 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 forRule.ImmutableRule.builder() .predicate(function.Predicate<net.bmahe.genetics4j.core.chromosomes.TreeNode<net.bmahe.genetics4j.gp.Operation<?>>>) // requiredpredicate.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 Rule builder
-