Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package net.jqwik.api;
import java.util.*;
import java.util.function.*;
import org.apiguardian.api.*;
import org.jspecify.annotations.*;
import static org.apiguardian.api.API.Status.*;
@API(status = MAINTAINED, since = "1.0")
public class Combinators {
@API(status = INTERNAL)
public static abstract class CombinatorsFacade {
private static final CombinatorsFacade implementation;
static {
implementation = FacadeLoader.load(CombinatorsFacade.class);
}
public abstract Combinator2 combine2(Arbitrary a1, Arbitrary a2);
public abstract Combinator3 combine3(Arbitrary a1, Arbitrary a2, Arbitrary a3);
public abstract Combinator4 combine4(
Arbitrary a1,
Arbitrary a2,
Arbitrary a3,
Arbitrary a4
);
public abstract Combinator5 combine5(
Arbitrary a1,
Arbitrary a2,
Arbitrary a3,
Arbitrary a4,
Arbitrary a5
);
public abstract Combinator6 combine6(
Arbitrary a1,
Arbitrary a2,
Arbitrary a3,
Arbitrary a4,
Arbitrary a5,
Arbitrary a6
);
public abstract Combinator7 combine7(
Arbitrary a1,
Arbitrary a2,
Arbitrary a3,
Arbitrary a4,
Arbitrary a5,
Arbitrary a6,
Arbitrary a7
);
public abstract Combinator8 combine8(
Arbitrary a1,
Arbitrary a2,
Arbitrary a3,
Arbitrary a4,
Arbitrary a5,
Arbitrary a6,
Arbitrary a7,
Arbitrary a8
);
public abstract ListCombinator combineList(List extends Arbitrary> listOfArbitraries);
}
private Combinators() {
}
/**
* Combine 2 arbitraries into one.
*
* @return Combinator2 instance which can be evaluated using {@linkplain Combinator2#as}
*/
public static Combinator2 combine(Arbitrary a1, Arbitrary a2) {
return CombinatorsFacade.implementation.combine2(a1, a2);
}
/**
* Combine 3 arbitraries into one.
*
* @return Combinator3 instance which can be evaluated using {@linkplain Combinator3#as}
*/
public static Combinator3 combine(Arbitrary a1, Arbitrary a2, Arbitrary a3) {
return CombinatorsFacade.implementation.combine3(a1, a2, a3);
}
/**
* Combine 4 arbitraries into one.
*
* @return Combinator4 instance which can be evaluated using {@linkplain Combinator4#as}
*/
public static Combinator4 combine(
Arbitrary a1, Arbitrary a2, Arbitrary a3,
Arbitrary a4
) {
return CombinatorsFacade.implementation.combine4(a1, a2, a3, a4);
}
/**
* Combine 5 arbitraries into one.
*
* @return Combinator5 instance which can be evaluated using {@linkplain Combinator5#as}
*/
public static Combinator5 combine(
Arbitrary a1, Arbitrary a2, Arbitrary a3,
Arbitrary a4, Arbitrary a5
) {
return CombinatorsFacade.implementation.combine5(a1, a2, a3, a4, a5);
}
/**
* Combine 6 arbitraries into one.
*
* @return Combinator6 instance which can be evaluated using {@linkplain Combinator6#as}
*/
public static Combinator6 combine(
Arbitrary a1, Arbitrary a2, Arbitrary a3,
Arbitrary a4, Arbitrary a5, Arbitrary a6
) {
return CombinatorsFacade.implementation.combine6(a1, a2, a3, a4, a5, a6);
}
/**
* Combine 7 arbitraries into one.
*
* @return Combinator7 instance which can be evaluated using {@linkplain Combinator7#as}
*/
public static Combinator7 combine(
Arbitrary a1, Arbitrary a2,
Arbitrary a3, Arbitrary a4, Arbitrary a5, Arbitrary a6, Arbitrary a7
) {
return CombinatorsFacade.implementation.combine7(a1, a2, a3, a4, a5, a6, a7);
}
/**
* Combine 8 arbitraries into one.
*
* @return Combinator8 instance which can be evaluated using {@linkplain Combinator8#as}
*/
public static Combinator8 combine(
Arbitrary a1, Arbitrary a2,
Arbitrary a3, Arbitrary a4, Arbitrary a5, Arbitrary a6, Arbitrary a7, Arbitrary a8
) {
return CombinatorsFacade.implementation.combine8(a1, a2, a3, a4, a5, a6, a7, a8);
}
/**
* Combine a list of arbitraries into one.
*
* @return ListCombinator instance which can be evaluated using {@linkplain ListCombinator#as}
*/
public static ListCombinator combine(List extends Arbitrary> listOfArbitraries) {
return CombinatorsFacade.implementation.combineList(listOfArbitraries);
}
/**
* Combinator for two values.
*/
public interface Combinator2 {
/**
* Combine two values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F2 super T1, ? super T2, ? extends R> combinator);
/**
* Filter two values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator2 filter(F2 super T1, ? super T2, Boolean> filter);
/**
* Combine two values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F2 super T1, ? super T2, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for three values.
*/
public interface Combinator3 {
/**
* Combine three values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F3 super T1, ? super T2, ? super T3, ? extends R> combinator);
/**
* Filter three values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator3 filter(F3 super T1, ? super T2, ? super T3, Boolean> filter);
/**
* Combine three values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F3 super T1, ? super T2, ? super T3, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for four values.
*/
public interface Combinator4 {
/**
* Combine four values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F4 super T1, ? super T2, ? super T3, ? super T4, ? extends R> combinator);
/**
* Filter four values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator4 filter(F4 super T1, ? super T2, ? super T3, ? super T4, Boolean> filter);
/**
* Combine four values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F4 super T1, ? super T2, ? super T3, ? super T4, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for five values.
*/
public interface Combinator5 {
/**
* Combine five values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F5 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> combinator);
/**
* Filter five values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator5 filter(F5 super T1, ? super T2, ? super T3, ? super T4, ? super T5, Boolean> filter);
/**
* Combine five values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F5 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for six values.
*/
public interface Combinator6 {
/**
* Combine six values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F6 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends R> combinator);
/**
* Filter six values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator6 filter(F6 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, Boolean> filter);
/**
* Combine six values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F6 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for seven values.
*/
public interface Combinator7 {
/**
* Combine seven values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F7 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? extends R> combinator);
/**
* Filter seven values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator7 filter(F7 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, Boolean> filter);
/**
* Combine seven values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F7> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for eight values.
*/
public interface Combinator8 {
/**
* Combine eight values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(F8 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> combinator);
/**
* Filter eight values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
Combinator8 filter(F8 super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, Boolean> filter);
/**
* Combine eight values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(F8> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
/**
* Combinator for any number of values.
*/
public interface ListCombinator {
/**
* Combine any number of values.
*
* @param combinator function
* @param return type
* @return arbitrary instance
*/
Arbitrary as(Function super List, ? extends R> combinator);
/**
* Filter list of values to only let them pass if the predicate is true.
*
* @param filter function
* @return combinator instance
*/
@API(status = MAINTAINED, since = "1.8.0")
ListCombinator filter(Predicate super List extends T>> filter);
/**
* Combine list of values to create a new arbitrary.
*
* @param flatCombinator function
* @param return type of arbitrary
* @return arbitrary instance
*/
default Arbitrary flatAs(Function super List extends T>, ? extends Arbitrary> flatCombinator) {
return as(flatCombinator).flatMap(Function.identity());
}
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F2 {
R apply(T1 t1, T2 t2);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F3 {
R apply(T1 t1, T2 t2, T3 t3);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F4 {
R apply(T1 t1, T2 t2, T3 t3, T4 t4);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F5 {
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F6 {
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F7 {
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7);
}
@FunctionalInterface
@API(status = INTERNAL)
public interface F8 {
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8);
}
}