net.jqwik.api.ExhaustiveGenerator Maven / Gradle / Ivy
The newest version!
package net.jqwik.api;
import java.util.function.*;
import org.apiguardian.api.*;
import org.jspecify.annotations.*;
import static org.apiguardian.api.API.Status.*;
/**
* Used only internally to run and compute exhaustive generation of parameters
*/
@API(status = INTERNAL)
public interface ExhaustiveGenerator extends Iterable {
long MAXIMUM_SAMPLES_TO_GENERATE = Integer.MAX_VALUE;
@API(status = INTERNAL)
abstract class ExhaustiveGeneratorFacade {
private static final ExhaustiveGeneratorFacade implementation;
static {
implementation = FacadeLoader.load(ExhaustiveGeneratorFacade.class);
}
public abstract ExhaustiveGenerator map(ExhaustiveGenerator self, Function super T, ? extends U> mapper);
public abstract ExhaustiveGenerator filter(ExhaustiveGenerator self, Predicate super T> filterPredicate, int maxMisses);
public abstract ExhaustiveGenerator<@Nullable T> injectNull(ExhaustiveGenerator self);
public abstract ExhaustiveGenerator ignoreExceptions(
ExhaustiveGenerator self,
Class extends Throwable>[] exceptionTypes,
int maxThrows
);
}
/**
* @return the maximum number of values that will be generated
*/
long maxCount();
default ExhaustiveGenerator map(Function super T, ? extends U> mapper) {
return ExhaustiveGeneratorFacade.implementation.map(this, mapper);
}
default ExhaustiveGenerator filter(Predicate super T> filterPredicate, int maxMisses) {
return ExhaustiveGeneratorFacade.implementation.filter(this, filterPredicate, maxMisses);
}
default ExhaustiveGenerator injectNull() {
return ExhaustiveGeneratorFacade.implementation.injectNull(this);
}
default ExhaustiveGenerator ignoreExceptions(int maxThrows, Class extends Throwable>[] exceptionTypes) {
return ExhaustiveGeneratorFacade.implementation.ignoreExceptions(this, exceptionTypes, maxThrows);
}
}