001package Torello.Java.Function;
002
003/**
004 * Function-Pointer
005 * <SPAN CLASS=TJF>Input:</SPAN> {@code A, B, C, D}
006 * <SPAN CLASS=TJF>Output:</SPAN> {@code void}.
007 * 
008 * <BR /><BR />
009 * <EMBED CLASS='external-html' DATA-FILE-ID=BIG_CONSUMER>
010 * <EMBED CLASS="globalDefs" DATA-Name='Quad Consumer' DATA-Number=four>
011 * 
012 * @param <A> The type of the first input-parameter.
013 * @param <B> The type of the second input-parameter.
014 * @param <C> The type of the third input-parameter.
015 * @param <D> The type of the last input-parameter.
016 */
017@FunctionalInterface
018public interface QuadConsumer<A, B, C, D>
019{
020    /**
021     * Performs {@code 'this'} operation on the given arguments.
022     * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH>
023     *
024     * @param a the first input argument
025     * @param b the second input argument
026     * @param c the third input argument
027     * @param d the fourth input argument
028     */
029    public void accept(A a, B b, C c, D d);
030
031    /**
032     * <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_METHOD>
033     * @param after <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_AFTER>
034     * @return <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_RETURN>
035     * @throws NullPointerException if parameter {@code 'other'} is null.
036     */
037    default QuadConsumer<A, B, C, D> andThen
038        (QuadConsumer<? super A, ? super B, ? super C, ? super D> after)
039    { 
040        if (after == null)
041            throw new NullPointerException("null has been passed to parameter 'after'");
042
043        return (A a, B b, C c, D d) ->
044        {
045            this.accept(a, b, c, d);
046            after.accept(a, b, c, d);
047        };
048    }
049 
050}