Class ImmutableRule.Builder
java.lang.Object
net.bmahe.genetics4j.gp.spec.mutation.ImmutableRule.Builder
- Enclosing class:
ImmutableRule
Builds instances of type
ImmutableRule
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final long
private static final long
private long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal ImmutableRule.Builder
applicator
(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Initializes the value for theapplicator
attribute.build()
Builds a newImmutableRule
.private String
final ImmutableRule.Builder
Fill a builder with attribute values from the providedRule
instance.final ImmutableRule.Builder
Initializes the value for thepredicate
attribute.
-
Field Details
-
INIT_BIT_PREDICATE
private static final long INIT_BIT_PREDICATE- See Also:
-
INIT_BIT_APPLICATOR
private static final long INIT_BIT_APPLICATOR- See Also:
-
initBits
private long initBits -
predicate
-
applicator
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedRule
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
predicate
Initializes the value for thepredicate
attribute.- Parameters:
predicate
- The value for predicate- Returns:
this
builder for use in a chained invocation
-
applicator
public final ImmutableRule.Builder applicator(BiFunction<Program, TreeNode<Operation<?>>, TreeNode<Operation<?>>> applicator) Initializes the value for theapplicator
attribute.- Parameters:
applicator
- The value for applicator- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableRule
.- Returns:
- An immutable instance of Rule
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-