001package Torello.Java.Function;
002
003import java.util.function.Function;
004
005/**
006 * <CODE>TriFunction Documentation.</CODE><BR /><BR />
007 * <EMBED CLASS="external-html" DATA-FILE-ID=BIGFUNC>
008 * <EMBED CLASS="globalDefs" DATA-Name='Tri Function' DATA-Number=three>
009 * @param <A> The type of the first input-parameter.
010 * @param <B> The type of the second input-parameter.
011 * @param <C> The type of the last input-parameter.
012 * @param <R> The type of the function-output.
013 */
014@FunctionalInterface
015public interface TriFunction<A, B, C, R>
016{
017    /**
018     * Applies {@code 'this'} function to the given arguments.
019     * @param a the first input argument
020     * @param b the second input argument
021     * @param c the third input argument
022     * @return The result of the function.  Return result is of type {@code 'R'}
023     */
024    public R apply(A a, B b, C c);
025
026    /**
027     * <EMBED CLASS="external-html" DATA-FILE-ID="FUNCTHENMETH">
028     * @param after <EMBED CLASS="external-html" DATA-FILE-ID="FUNCTHENAFT">
029     * @return a composed {@code 'TriFunction'}, that first applies {@code 'this'} function, and
030     * then applies the {@code 'after'} function.
031     * @throws NullPointerException This is thrown if {@code 'after'} is null.
032     */
033    default <V> TriFunction<A, B, C, V> andThen(Function<? super R, ? extends V> after)
034    {
035        if (after == null)
036            throw new NullPointerException("parameter 'after' has been passed null.");
037
038        return (A a, B b, C c) -> after.apply(this.apply(a, b, c));
039    }
040 
041}