Class ImmutableTrimTree
java.lang.Object
net.bmahe.genetics4j.gp.spec.mutation.ImmutableTrimTree
- All Implemented Interfaces:
MutationPolicy,TrimTree
@Generated(from="TrimTree",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableTrimTree
extends Object
implements TrimTree
Immutable implementation of
TrimTree.
Use the builder to create immutable instances:
ImmutableTrimTree.builder().
Use the static factory method to create immutable instances:
ImmutableTrimTree.of().
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableTrimTree(Optional<Integer> maxDepth) privateprivateImmutableTrimTree(ImmutableTrimTree original, Integer maxDepth) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableTrimTree.Builderbuilder()Creates a builder forTrimTree.static TrimTreeCreates an immutable copy of aTrimTreevalue.booleanThis instance is equal to all instances ofImmutableTrimTreethat have equal attribute values.private booleanequalsByValue(ImmutableTrimTree another) inthashCode()Computes a hash code from attributes:maxDepth.maxDepth()Override the max depth to enforcestatic TrimTreeConstruct a new immutableTrimTreeinstance.toString()Prints the immutable valueTrimTreewith attribute values.private static ImmutableTrimTreevalidate(ImmutableTrimTree instance) final ImmutableTrimTreewithMaxDepth(int value) Copy the current immutable object by setting a present value for the optionalmaxDepthattribute.final ImmutableTrimTreewithMaxDepth(Optional<Integer> optional) Copy the current immutable object by setting an optional value for themaxDepthattribute.
-
Field Details
-
maxDepth
-
-
Constructor Details
-
ImmutableTrimTree
-
ImmutableTrimTree
-
ImmutableTrimTree
-
-
Method Details
-
maxDepth
Override the max depth to enforce -
withMaxDepth
Copy the current immutable object by setting a present value for the optionalmaxDepthattribute.- Parameters:
value- The value for maxDepth- Returns:
- A modified copy or
thisif not changed
-
withMaxDepth
Copy the current immutable object by setting an optional value for themaxDepthattribute. An equality check is used on inner value to prevent copying of the same value by returningthis.- Parameters:
optional- An optional value for maxDepth- Returns:
- A modified copy or
thisif not changed
-
equals
This instance is equal to all instances ofImmutableTrimTreethat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:maxDepth. -
toString
Prints the immutable valueTrimTreewith attribute values. -
of
Construct a new immutableTrimTreeinstance.- Parameters:
maxDepth- The value for themaxDepthattribute- Returns:
- An immutable TrimTree instance
-
validate
-
copyOf
Creates an immutable copy of aTrimTreevalue. 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 TrimTree instance
-
builder
Creates a builder forTrimTree.ImmutableTrimTree.builder() .maxDepth(Optional<Integer>) // optionalmaxDepth.build();- Returns:
- A new TrimTree builder
-