Class ImmutableEmpiricalFunction

java.lang.Object
io.github.ai4ci.util.ImmutableEmpiricalFunction
All Implemented Interfaces:
Abstraction.SimpleFunction, EmpiricalFunction, Serializable

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableEmpiricalFunction extends Object implements EmpiricalFunction
Immutable implementation of EmpiricalFunction.

Use the builder to create immutable instances: ImmutableEmpiricalFunction.builder().

See Also:
  • Method Details

    • getX

      public double[] getX()
      Specified by:
      getX in interface EmpiricalFunction
      Returns:
      A cloned x array
    • getY

      public double[] getY()
      Specified by:
      getY in interface EmpiricalFunction
      Returns:
      A cloned y array
    • getLink

      public EmpiricalFunction.Link getLink()
      Specified by:
      getLink in interface EmpiricalFunction
      Returns:
      The value of the link attribute
    • getMin

      public double getMin()
      Specified by:
      getMin in interface EmpiricalFunction
      Returns:
      The computed-at-construction value of the min attribute
    • getMax

      public double getMax()
      Specified by:
      getMax in interface EmpiricalFunction
      Returns:
      The computed-at-construction value of the max attribute
    • getInterpolator

      public SplineInterpolator getInterpolator()
      Specified by:
      getInterpolator in interface EmpiricalFunction
      Returns:
      The computed-at-construction value of the interpolator attribute
    • withX

      public final ImmutableEmpiricalFunction withX(double... elements)
      Copy the current immutable object with elements that replace the content of x. The array is cloned before being saved as attribute values.
      Parameters:
      elements - The non-null elements for x
      Returns:
      A modified copy of this object
    • withY

      public final ImmutableEmpiricalFunction withY(double... elements)
      Copy the current immutable object with elements that replace the content of y. The array is cloned before being saved as attribute values.
      Parameters:
      elements - The non-null elements for y
      Returns:
      A modified copy of this object
    • withLink

      public final ImmutableEmpiricalFunction withLink(EmpiricalFunction.Link value)
      Copy the current immutable object by setting a value for the link attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for link
      Returns:
      A modified copy of the this object
    • equals

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

      public int hashCode()
      Computes a hash code from attributes: x, y, link, min, max, interpolator.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableEmpiricalFunction copyOf(EmpiricalFunction instance)
      Creates an immutable copy of a EmpiricalFunction 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 EmpiricalFunction instance
    • toBuilder

      Creates a builder for ImmutableEmpiricalFunction.prefilled with attibute values of this instance to easily create modified copies.
      Returns:
      A new ImmutableEmpiricalFunction builder with attributes of this instance
    • builder

      public static ImmutableEmpiricalFunction.Builder builder()
      Creates a builder for ImmutableEmpiricalFunction.
       ImmutableEmpiricalFunction.builder()
          .setX(double) // required x
          .setY(double) // required y
          .setLink(io.github.ai4ci.util.EmpiricalFunction.Link) // optional link
          .build();
       
      Returns:
      A new ImmutableEmpiricalFunction builder