Interface Sampling<T>

All Known Implementing Classes:
SampleBuffer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Sampling<T>
This interface represents a set of sample points, which can be evaluated with a given evolved program.
Since:
6.0
Version:
7.1
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    This class represents the result of a sample calculation, which contains the array of calculated values and a corresponding array with expected sample values.
  • Method Summary

    Modifier and Type
    Method
    Description
    eval(Tree<? extends Op<T>,?> program)
    Evaluates the given program tree with its sample points.
    eval(Function<? super T[],? extends T> function)
    Evaluates the given function tree with its sample points.
    static <T> Sampling<T>
    of(Sample<? extends T>... samples)
    Create a new sampling object from the given sample points.
    static <T> Sampling<T>
    of(List<? extends Sample<? extends T>> samples)
    Create a new sampling object from the given sample points.
  • Method Details

    • eval

      Sampling.Result<T> eval(Tree<? extends Op<T>,?> program)
      Evaluates the given program tree with its sample points. The returned result object may be null if no sample point has been added to the sampling when calling the eval method.
      Parameters:
      program - the program to evaluate
      Returns:
      the evaluated sample result. May be null if the sampling is empty and contains no sample points.
    • eval

      default Sampling.Result<T> eval(Function<? super T[],? extends T> function)
      Evaluates the given function tree with its sample points. The returned result object may be null if no sample point has been added to the sampling when calling the eval method.
      Parameters:
      function - the function to evaluate
      Returns:
      the evaluated sample result. May be null if the sampling is empty and contains no sample points.
    • of

      static <T> Sampling<T> of(List<? extends Sample<? extends T>> samples)
      Create a new sampling object from the given sample points.
      Type Parameters:
      T - the sample type
      Parameters:
      samples - the sample points
      Returns:
      a new sampling object
      Since:
      7.1
    • of

      @SafeVarargs static <T> Sampling<T> of(Sample<? extends T>... samples)
      Create a new sampling object from the given sample points.
      Type Parameters:
      T - the sample type
      Parameters:
      samples - the sample points
      Returns:
      a new sampling object
      Since:
      7.1