de.caff.generics.function

## Interface Procedure4<P1,P2,P3,P4>

- Type Parameters:
    `P1` - first parameter type
    `P2` - second parameter type
    `P3` - third parameter type
    `P4` - fourth parameter type
  All Superinterfaces:
    java.util.function.Consumer<ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>>, Procedure1<ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>>
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface Procedure4<P1,P2,P3,P4>
      extends Procedure1<ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>>

  Function without return and with four parameters.
  Author:
    Rammi
  See Also:
    `Procedure0`, `Procedure1`, `Procedure2`, `Procedure3`, `Procedure5`, `Procedure6`, `Procedure7`, `Procedure8`, `Procedure9`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Procedure4<?,?,?,?>` | `NULL` Procedure with four arguments which does nothing.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default void` | `accept(ITuple4<? extends P1,? extends P2,? extends P3,? extends P4> tuple4)` Expand a tuple into the arguments of this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP> Procedure1<FP>` | `after1(java.util.function.Function<FP,FR> before)` Get a chained procedure which first applies the given function, then this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2> Procedure2<FP1,FP2>` | `after2(java.util.function.BiFunction<FP1,FP2,FR> before)` Get a chained procedure which first applies the given 2-parameter function, then this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3> Procedure3<FP1,FP2,FP3>` | `after3(Function3<FR,FP1,FP2,FP3> before)` Get a chained procedure which first applies the given 3-parameter function, then this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5> Procedure5<FP1,FP2,FP3,FP4,FP5>` | `after5(Function5<FR,FP1,FP2,FP3,FP4,FP5> before)` Get a chained procedure which first applies the given 5-parameter function, then this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6> Procedure6<FP1,FP2,FP3,FP4,FP5,FP6>` | `after6(Function6<FR,FP1,FP2,FP3,FP4,FP5,FP6> before)` Get a chained procedure which first applies the given 6-parameter function, then this procedure.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7> Procedure7<FP1,FP2,FP3,FP4,FP5,FP6,FP7>` | `after7(Function7<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7> before)` Get a chained procedure which first applies the given 7-parameter function, then this one.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8> Procedure8<FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8>` | `after8(Function8<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8> before)` Get a chained procedure which first applies the given 8-parameter function, then this one.
    `default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9> Procedure9<FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9>` | `after9(Function9<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9> before)` Get a chained procedure which first applies the given 9-parameter function, then this one.
    `void` | `apply(P1 arg1, P2 arg2, P3 arg3, P4 arg4)` Run the procedure.
    `static <T1,T2,T3,T4> Procedure4<T1,T2,T3,T4>` | `empty()` Return a procedure which does nothing.
    `static <E extends java.lang.Exception,PP1,PP2,PP3,PP4> Procedure4<PP1,PP2,PP3,PP4>` | `nonFragile(FragileProcedure4<E,? super PP1,? super PP2,? super PP3,? super PP4> fragileProc)` Convert a 4-argument procedure which might throw a checked exception into one which does throw an unchecked exception.
    `static <E extends java.lang.Exception,PP1,PP2,PP3,PP4> Procedure4<PP1,PP2,PP3,PP4>` | `nonFragileX(FragileProcedure4<E,? super PP1,? super PP2,? super PP3,? super PP4> fragileProc, Procedure5<? super E,? super PP1,? super PP2,? super PP3,? super PP4> exceptionHandler)` Convert a 4-argument procedure which might throw a checked exception into one for which you can decide what happens with the exception.
    `default Procedure3<P2,P3,P4>` | `partial1(P1 argument)` Get a partially applied procedure.
    `default Procedure3<P1,P3,P4>` | `partial2(P2 argument)` Get a partially applied procedure.
    `default Procedure3<P1,P2,P4>` | `partial3(P3 argument)` Get a partially applied procedure.
    `default Procedure3<P1,P2,P3>` | `partial4(P4 argument)` Get a partially applied procedure.

    - ### Methods inherited from interface de.caff.generics.function.Procedure1

      `apply, applyNonNull, from, nonFragile, nonFragileX, partial`

    - ### Methods inherited from interface java.util.function.Consumer

      `andThen`

- - ### Field Detail

    - #### NULL

          @NotNull
          static final Procedure4<?,?,?,?> NULL

      Procedure with four arguments which does nothing. Use `empty()` instead.

  - ### Method Detail

    - #### apply

          void apply(P1 arg1,
                     P2 arg2,
                     P3 arg3,
                     P4 arg4)

      Run the procedure.
      Parameters:
        `arg1` - first procedure argument
        `arg2` - second procedure argument
        `arg3` - third procedure argument
        `arg4` - fourth procedure argument

    - #### accept

          default void accept(@NotNull
                              ITuple4<? extends P1,? extends P2,? extends P3,? extends P4> tuple4)

      Expand a tuple into the arguments of this procedure.
      Specified by:
        `accept` in interface `java.util.function.Consumer<ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>>`
      Parameters:
        `tuple4` - tuple to expand

    - #### partial1

          @NotNull
          default Procedure3<P2,P3,P4> partial1(P1 argument)

      Get a partially applied procedure.
      Parameters:
        `argument` - value applied for first argument
      Returns:
        partially evaluated procedure

    - #### partial2

          @NotNull
          default Procedure3<P1,P3,P4> partial2(P2 argument)

      Get a partially applied procedure.
      Parameters:
        `argument` - value applied for second argument
      Returns:
        partially evaluated procedure

    - #### partial3

          @NotNull
          default Procedure3<P1,P2,P4> partial3(P3 argument)

      Get a partially applied procedure.
      Parameters:
        `argument` - value applied for third argument
      Returns:
        partially evaluated procedure

    - #### partial4

          @NotNull
          default Procedure3<P1,P2,P3> partial4(P4 argument)

      Get a partially applied procedure.
      Parameters:
        `argument` - value applied for fourth argument
      Returns:
        partially evaluated procedure

    - #### after1

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP> Procedure1<FP> after1(@NotNull
                                                                                                                              java.util.function.Function<FP,FR> before)

      Get a chained procedure which first applies the given function, then this procedure. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP` - function `before`'s parameter type, same for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of function and this procedure

    - #### after2

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2> Procedure2<FP1,FP2> after2(@NotNull
                                                                                                                                        java.util.function.BiFunction<FP1,FP2,FR> before)

      Get a chained procedure which first applies the given 2-parameter function, then this procedure. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, same for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after3

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3> Procedure3<FP1,FP2,FP3> after3(@NotNull
                                                                                                                                                Function3<FR,FP1,FP2,FP3> before)

      Get a chained procedure which first applies the given 3-parameter function, then this procedure. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after5

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5> Procedure5<FP1,FP2,FP3,FP4,FP5> after5(@NotNull
                                                                                                                                                                Function5<FR,FP1,FP2,FP3,FP4,FP5> before)

      Get a chained procedure which first applies the given 5-parameter function, then this procedure. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this function.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
        `FP4` - function `before`'s fourth parameter type, sane for returned procedure
        `FP5` - function `before`'s fifth parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after6

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6> Procedure6<FP1,FP2,FP3,FP4,FP5,FP6> after6(@NotNull
                                                                                                                                                                        Function6<FR,FP1,FP2,FP3,FP4,FP5,FP6> before)

      Get a chained procedure which first applies the given 6-parameter function, then this procedure. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this function.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
        `FP4` - function `before`'s fourth parameter type, sane for returned procedure
        `FP5` - function `before`'s fifth parameter type, sane for returned procedure
        `FP6` - function `before`'s sixth parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after7

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7> Procedure7<FP1,FP2,FP3,FP4,FP5,FP6,FP7> after7(@NotNull
                                                                                                                                                                                Function7<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7> before)

      Get a chained procedure which first applies the given 7-parameter function, then this one. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
        `FP4` - function `before`'s fourth parameter type, sane for returned procedure
        `FP5` - function `before`'s fifth parameter type, sane for returned procedure
        `FP6` - function `before`'s sixth parameter type, sane for returned procedure
        `FP7` - function `before`'s seventh parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after8

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8> Procedure8<FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8> after8(@NotNull
                                                                                                                                                                                        Function8<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8> before)

      Get a chained procedure which first applies the given 8-parameter function, then this one. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
        `FP4` - function `before`'s fourth parameter type, sane for returned procedure
        `FP5` - function `before`'s fifth parameter type, sane for returned procedure
        `FP6` - function `before`'s sixth parameter type, sane for returned procedure
        `FP7` - function `before`'s seventh parameter type, sane for returned procedure
        `FP8` - function `before`'s seventh parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### after9

          @NotNull
          default <FR extends ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9> Procedure9<FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9> after9(@NotNull
                                                                                                                                                                                                Function9<FR,FP1,FP2,FP3,FP4,FP5,FP6,FP7,FP8,FP9> before)

      Get a chained procedure which first applies the given 9-parameter function, then this one. The given function has to return a `ITuple4` with matching parametric types which are applied in their order to this procedure.
      Type Parameters:
        `FR` - function `before`'s return type, has to be a 4-tuple with matching types
        `FP1` - function `before`'s first parameter type, sane for returned procedure
        `FP2` - function `before`'s second parameter type, sane for returned procedure
        `FP3` - function `before`'s third parameter type, sane for returned procedure
        `FP4` - function `before`'s fourth parameter type, sane for returned procedure
        `FP5` - function `before`'s fifth parameter type, sane for returned procedure
        `FP6` - function `before`'s sixth parameter type, sane for returned procedure
        `FP7` - function `before`'s seventh parameter type, sane for returned procedure
        `FP8` - function `before`'s seventh parameter type, sane for returned procedure
        `FP9` - function `before`'s ninth parameter type, sane for returned procedure
      Parameters:
        `before` - function to apply first, has to return a non-`null` result so unpacking the parameters from the tuple is possible
      Returns:
        chain of the given function and this procedure

    - #### empty

          @NotNull
          static <T1,T2,T3,T4> Procedure4<T1,T2,T3,T4> empty()

      Return a procedure which does nothing. This just returns `NULL`, but the compiler will accept it smoothly.
      Specified by:
        `empty` in interface `Procedure1<ITuple4<? extends P1,? extends P2,? extends P3,? extends P4>>`
      Type Parameters:
        `T1` - first argument type
        `T2` - second argument type
        `T3` - third argument type
        `T4` - fourth argument type
      Returns:
        do-nothing procedure

    - #### nonFragile

          @NotNull
          static <E extends java.lang.Exception,PP1,PP2,PP3,PP4> Procedure4<PP1,PP2,PP3,PP4> nonFragile(@NotNull
                                                                                                                 FragileProcedure4<E,? super PP1,? super PP2,? super PP3,? super PP4> fragileProc)

      Convert a 4-argument procedure which might throw a checked exception into one which does throw an unchecked exception. The returned function will instead throw an unchecked `WrappedFragileException` for any checked exception thrown during `Procedure1.apply(Object)`.
      Type Parameters:
        `E` - exception type
        `PP1` - type of first parameter
        `PP2` - type of second parameter
        `PP3` - type of third parameter
        `PP4` - type of fourth parameter
      Parameters:
        `fragileProc` - procedure throwing a checked exception
      Returns:
        non-fragile procedure

    - #### nonFragileX

          @NotNull
          static <E extends java.lang.Exception,PP1,PP2,PP3,PP4> Procedure4<PP1,PP2,PP3,PP4> nonFragileX(@NotNull
                                                                                                                  FragileProcedure4<E,? super PP1,? super PP2,? super PP3,? super PP4> fragileProc,
                                                                                                                  @NotNull
                                                                                                                  Procedure5<? super E,? super PP1,? super PP2,? super PP3,? super PP4> exceptionHandler)

      Convert a 4-argument procedure which might throw a checked exception into one for which you can decide what happens with the exception. The exception handler allows
      - throw an unchecked exception instead (compare `nonFragile(FragileProcedure4)`)
      - do nothing
      - include logging in one of the above
      - and more...
      Type Parameters:
        `E` - exception type
        `PP1` - type of first parameter
        `PP2` - type of second parameter
        `PP3` - type of third parameter
        `PP4` - type of fourth parameter
      Parameters:
        `fragileProc` - procedure throwing a checked exception
        `exceptionHandler` - exception handler. Its return value will be used as return value of the returned function.
      Returns:
        non-fragile function