Class ImmutableTrimTree

java.lang.Object
net.bmahe.genetics4j.gp.spec.mutation.ImmutableTrimTree
All Implemented Interfaces:
MutationPolicy, TrimTree

@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().

  • Field Details

  • Constructor Details

  • Method Details

    • maxDepth

      public Optional<Integer> maxDepth()
      Override the max depth to enforce
      Specified by:
      maxDepth in interface TrimTree
      Returns:
    • withMaxDepth

      public final ImmutableTrimTree withMaxDepth(Optional<Integer> value)
      Copy the current immutable object by setting a value for the maxDepth attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for maxDepth
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableTrimTree that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • equalTo

      private boolean equalTo(int synthetic, ImmutableTrimTree another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: maxDepth.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value TrimTree with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static ImmutableTrimTree of(Optional<Integer> maxDepth)
      Construct a new immutable TrimTree instance.
      Parameters:
      maxDepth - The value for the maxDepth attribute
      Returns:
      An immutable TrimTree instance
    • validate

      private static ImmutableTrimTree validate(ImmutableTrimTree instance)
    • copyOf

      public static ImmutableTrimTree copyOf(TrimTree instance)
      Creates an immutable copy of a TrimTree 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 TrimTree instance
    • builder

      public static ImmutableTrimTree.Builder builder()
      Creates a builder for ImmutableTrimTree.
       ImmutableTrimTree.builder()
          .maxDepth(Optional&lt;Integer&gt;) // optional maxDepth
          .build();
       
      Returns:
      A new ImmutableTrimTree builder