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

  • Field Details

  • Constructor Details

  • Method Details

    • predicate

      public Predicate<TreeNode<Operation<?>>> predicate()
      Specified by:
      predicate in interface Rule
      Returns:
      The value of the predicate attribute
    • applicator

      public BiFunction<Program,TreeNode<Operation<?>>,TreeNode<Operation<?>>> applicator()
      Specified by:
      applicator in interface Rule
      Returns:
      The value of the applicator attribute
    • withPredicate

      public final ImmutableRule withPredicate(Predicate<TreeNode<Operation<?>>> value)
      Copy the current immutable object by setting a value for the predicate attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      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 the applicator attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for applicator
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableRule 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, ImmutableRule another)
    • hashCode

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

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

      public static ImmutableRule of(Predicate<TreeNode<Operation<?>>> predicate, BiFunction<Program,TreeNode<Operation<?>>,TreeNode<Operation<?>>> applicator)
      Construct a new immutable Rule instance.
      Parameters:
      predicate - The value for the predicate attribute
      applicator - The value for the applicator attribute
      Returns:
      An immutable Rule instance
    • copyOf

      public static ImmutableRule copyOf(Rule instance)
      Creates an immutable copy of a Rule 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

      public static ImmutableRule.Builder builder()
      Creates a builder for ImmutableRule.
       ImmutableRule.builder()
          .predicate(function.Predicate&lt;net.bmahe.genetics4j.core.chromosomes.TreeNode&lt;net.bmahe.genetics4j.gp.Operation&lt;?&gt;&gt;&gt;) // required predicate
          .applicator(function.BiFunction&lt;net.bmahe.genetics4j.gp.program.Program, net.bmahe.genetics4j.core.chromosomes.TreeNode&lt;net.bmahe.genetics4j.gp.Operation&lt;?&gt;&gt;, net.bmahe.genetics4j.core.chromosomes.TreeNode&lt;net.bmahe.genetics4j.gp.Operation&lt;?&gt;&gt;&gt;) // required applicator
          .build();
       
      Returns:
      A new ImmutableRule builder