cyclops.function.PartialApplicator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops Show documentation
Show all versions of cyclops Show documentation
Platform for Functional Reactive Programming with Java 8
The newest version!
package cyclops.function;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* This class consists exclusively of static methods that return function
* that are partially applied with parameters.
*
* Note: Partial application has been done up to an arity of 8 so far.
*/
public class PartialApplicator extends Lambda {
/**
* Returns a function with 1 arguments applied to the supplied Function
* @param t1 Generic argument
* @param func Function
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming TriFunction
*/
public static Supplier partial(final T1 t1, final Function func) {
return () -> func.apply(t1);
}
/**
* Returns a function with 2 arguments applied to the supplied BiFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param biFunc Function that accepts 2 parameters
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming TriFunction
*/
public static Supplier partial2(final T1 t1, final T2 t2, final BiFunction biFunc) {
return () -> biFunc.apply(t1, t2);
}
/**
* Returns a function with 1 arguments applied to the supplied BiFunction
* @param t1 Generic argument
* @param biFunc Function that accepts 2 parameters
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming BiFunction
*/
public static Function partial2(final T1 t1, final BiFunction biFunc) {
return (t2) -> biFunc.apply(t1, t2);
}
/**
* Returns a function with 1 arguments applied to the supplied BiFunction
* @param t2 Generic argument
* @param biFunc Function that accepts 2 parameters
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming BiFunction
*/
public static Function partial2b(final T2 t2, final BiFunction biFunc) {
return (t1) -> biFunc.apply(t1, t2);
}
/**
* Returns a function with 3 arguments applied to the supplied TriFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param triFunc Function that accepts 3 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming TriFunction
*/
public static Supplier partial3(final T1 t1, final T2 t2, final T3 t3, final Function3 triFunc) {
return () -> triFunc.apply(t1, t2, t3);
}
/**
* Returns a function with 2 arguments applied to the supplied TriFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param triFunc Function that accepts 3 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 2 arguments being applied to the incoming TriFunction
*/
public static Function partial3(final T1 t1, final T2 t2, final Function3 triFunc) {
return (t3) -> triFunc.apply(t1, t2, t3);
}
/**2
* Returns a BiFunction with 1 argument applied to the supplied TriFunction
* @param t1 Generic Argument
* @param triFunc Function that accepts 3 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param BiFunction generic return type
* @return BiFunction as a result of 1 argument being applied to the incoming TriFunction
*/
public static BiFunction partial3(final T1 t1, final Function3 triFunc) {
return (t2, t3) -> triFunc.apply(t1, t2, t3);
}
/**
* Returns a Function with 3 arguments applied to the supplied QuadFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param quadFunc Function that accepts 4 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 3 argument being applied to the incoming QuadFunction
*/
public static Supplier partial4(final T1 t1, final T2 t2, final T3 t3, final T4 t4,
final Function4 quadFunc) {
return () -> quadFunc.apply(t1, t2, t3, t4);
}
/**
* Returns a Function with 3 arguments applied to the supplied QuadFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param quadFunc Function that accepts 4 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 3 argument being applied to the incoming QuadFunction
*/
public static Function partial4(final T1 t1, final T2 t2, final T3 t3,
final Function4 quadFunc) {
return (t4) -> quadFunc.apply(t1, t2, t3, t4);
}
/**
* Returns a BiFunction with 2 arguments applied to the supplied QuadFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param quadFunc Function that accepts 4 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return BiFunction as a result of 2 arguments being applied to the incoming QuadFunction
*/
public static BiFunction partial4(final T1 t1, final T2 t2, final Function4 quadFunc) {
return (t3, t4) -> quadFunc.apply(t1, t2, t3, t4);
}
/**
* Returns a BiFunction with 1 argument applied to the supplied QuadFunction
* @param t1 Generic argument
* @param quadFunc Function that accepts 4 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return TriFunction as a result of 1 argument being applied to the incoming QuadFunction
*/
public static Function3 partial4(final T1 t1, final Function4 quadFunc) {
return (t2, t3, t4) -> quadFunc.apply(t1, t2, t3, t4);
}
/**
* Returns a Function with 4 arguments applied to the supplied QuintFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param quintFunc Function that accepts 5 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 4 arguments being applied to the incoming QuintFunction
*/
public static Supplier partial5(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final Function5 quintFunc) {
return () -> quintFunc.apply(t1, t2, t3, t4, t5);
}
/**
* Returns a Function with 4 arguments applied to the supplied QuintFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param quintFunc Function that accepts 5 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 4 arguments being applied to the incoming QuintFunction
*/
public static Function partial5(final T1 t1, final T2 t2, final T3 t3, final T4 t4,
final Function5 quintFunc) {
return (t5) -> quintFunc.apply(t1, t2, t3, t4, t5);
}
/**
* Returns a BiFunction with 3 arguments applied to the supplied QuintFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param quintFunc Function that accepts 5 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return BiFunction as a result of 3 arguments being applied to the incoming QuintFunction
*/
public static BiFunction partial5(final T1 t1, final T2 t2, final T3 t3,
final Function5 quintFunc) {
return (t4, t5) -> quintFunc.apply(t1, t2, t3, t4, t5);
}
/**
* Returns a TriFunction with 2 arguments applied to the supplied QuintFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param quintFunc Function that accepts 5 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return TriFunction as a result of 2 arguments being applied to the incoming QuintFunction
*/
public static Function3 partial5(final T1 t1, final T2 t2,
final Function5 quintFunc) {
return (t3, t4, t5) -> quintFunc.apply(t1, t2, t3, t4, t5);
}
/**
* Returns a QuadFunction with 1 argument applied to the supplied QuintFunction
* @param t1 Generic argument
* @param quintFunc Function that accepts 5 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return QuadFunction as a result of 1 argument being applied to the incoming QuintFunction
*/
public static Function4 partial5(final T1 t1,
final Function5 quintFunc) {
return (t2, t3, t4, t5) -> quintFunc.apply(t1, t2, t3, t4, t5);
}
/**
* Returns a Function with 5 arguments applied to the supplied HexFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param t5 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 5 arguments being applied to the incoming HexFunction
*/
public static Supplier partial6(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5, final T6 t6,
final Function6 hexFunc) {
return () -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a Function with 5 arguments applied to the supplied HexFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param t5 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 5 arguments being applied to the incoming HexFunction
*/
public static Function partial6(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final Function6 hexFunc) {
return (t6) -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a BiFunction with 4 arguments applied to the supplied HexFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return BiFunction as a result of 4 arguments being applied to the incoming HexFunction
*/
public static BiFunction partial6(final T1 t1, final T2 t2, final T3 t3, final T4 t4,
final Function6 hexFunc) {
return (t5, t6) -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a TriFunction with 3 arguments applied to the supplied HexFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return TriFunction as a result of 3 arguments being applied to the incoming HexFunction
*/
public static Function3 partial6(final T1 t1, final T2 t2, final T3 t3,
final Function6 hexFunc) {
return (t4, t5, t6) -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a QuadFunction with 2 arguments applied to the supplied HexFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return QuadFunction as a result of 2 arguments being applied to the incoming HexFunction
*/
public static Function4 partial6(final T1 t1, final T2 t2,
final Function6 hexFunc) {
return (t3, t4, t5, t6) -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a QuintFunction with 1 argument applied to the supplied HexFunction
* @param t1 Generic argument
* @param hexFunc Function that accepts 6 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return QuintFunction as a result of 1 argument being applied to the incoming HexFunction
*/
public static Function5 partial6(final T1 t1,
final Function6 hexFunc) {
return (t2, t3, t4, t5, t6) -> hexFunc.apply(t1, t2, t3, t4, t5, t6);
}
/**
* Returns a Function with 6 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param t5 Generic argument
* @param t6 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 6 arguments being applied to the supplied HeptFunction
*/
public static Supplier partial7(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5, final T6 t6,
final T7 t7, final Function7 heptFunc) {
return () -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a Function with 6 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param t5 Generic argument
* @param t6 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return Function as a result of 6 arguments being applied to the supplied HeptFunction
*/
public static Function partial7(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final T6 t6, final Function7 heptFunc) {
return (t7) -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a BiFunction with 5 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param t5 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return BiFunction as a result of 5 arguments being applied to the supplied HeptFunction
*/
public static BiFunction partial7(final T1 t1, final T2 t2, final T3 t3, final T4 t4, final T5 t5,
final Function7 heptFunc) {
return (t6, t7) -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a TriFunction with 4 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param t4 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return TriFunction as a result of 4 arguments being applied to the supplied HeptFunction
*/
public static Function3 partial7(final T1 t1, final T2 t2, final T3 t3, final T4 t4,
final Function7 heptFunc) {
return (t5, t6, t7) -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a QuadFunction with 3 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param t3 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return QuadFunction as a result of 3 arguments being applied to the supplied HeptFunction
*/
public static Function4 partial7(final T1 t1, final T2 t2, final T3 t3,
final Function7 heptFunc) {
return (t4, t5, t6, t7) -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a QuintFunction with 2 arguments applied to the supplied HeptFunction
* @param t1 Generic argument
* @param t2 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param Function generic return type
* @return QuintFunction as a result of 2 arguments being applied to the supplied HeptFunction
*/
public static Function5 partial7(final T1 t1, final T2 t2,
final Function7 heptFunc) {
return (t3, t4, t5, t6, t7) -> heptFunc.apply(t1, t2, t3, t4, t5, t6, t7);
}
/**
* Returns a HexFunction with 1 argument applied to the supplied HeptFunction
* @param t1 Generic argument
* @param heptFunc Function that accepts 7 parameters
* @param Generic argument type
* @param Generic argument type
* @param Generic argument type
* @param