All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.api.ExhaustiveGenerator Maven / Gradle / Ivy

There is a newer version: 1.9.2
Show newest version
package net.jqwik.api;

import java.util.function.*;

import org.apiguardian.api.*;

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 mapper);

		public abstract  ExhaustiveGenerator filter(ExhaustiveGenerator self, Predicate filterPredicate);

		public abstract  ExhaustiveGenerator injectNull(ExhaustiveGenerator self);

		public abstract  ExhaustiveGenerator ignoreException(ExhaustiveGenerator self, Class exceptionType);
	}

	/**
	 * @return the maximum number of values that will be generated
	 */
	long maxCount();

	default  ExhaustiveGenerator map(Function mapper) {
		return ExhaustiveGeneratorFacade.implementation.map(this, mapper);
	}

	default ExhaustiveGenerator filter(Predicate filterPredicate) {
		return ExhaustiveGeneratorFacade.implementation.filter(this, filterPredicate);
	}

	default ExhaustiveGenerator injectNull() {
		return ExhaustiveGeneratorFacade.implementation.injectNull(this);
	}

	default ExhaustiveGenerator ignoreException(Class exceptionType) {
		return ExhaustiveGeneratorFacade.implementation.ignoreException(this, exceptionType);
	}


}