Package fj

Class P4<A,B,C,D>

java.lang.Object
fj.P4<A,B,C,D>

public abstract class P4<A,B,C,D> extends Object
A product-4.
  • Constructor Summary

    Constructors
    Constructor
    Description
    P4()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <A, B, C, D>
    F<P4<A,B,C,D>,A>
    __1()
    Returns a function that returns the first element of a product.
    static <A, B, C, D>
    F<P4<A,B,C,D>,B>
    __2()
    Returns a function that returns the second element of a product.
    static <A, B, C, D>
    F<P4<A,B,C,D>,C>
    __3()
    Returns a function that returns the third element of a product.
    static <A, B, C, D>
    F<P4<A,B,C,D>,D>
    __4()
    Returns a function that returns the fourth element of a product.
    abstract A
    _1()
    Access the first element of the product.
    final P1<A>
    _1_()
    Returns the 1-product projection over the first element.
    abstract B
    _2()
    Access the second element of the product.
    final P1<B>
    _2_()
    Returns the 1-product projection over the second element.
    abstract C
    _3()
    Access the third element of the product.
    final P1<C>
    _3_()
    Returns the 1-product projection over the third element.
    abstract D
    _4()
    Access the fourth element of the product.
    final P1<D>
    _4_()
    Returns the 1-product projection over the fourth element.
    final <E> P5<A,B,C,D,E>
    append(E el)
    Creates a P5 by adding the given element to the current P4
    final <E, F> P6<A,B,C,D,E,F>
    append(P2<E,F> el)
    Creates a P6 by adding the given element to the current P4
    final <E, F, G> P7<A,B,C,D,E,F,G>
    append(P3<E,F,G> el)
    Creates a P7 by adding the given element to the current P4
    final <E, F, G, H>
    P8<A,B,C,D,E,F,G,H>
    append(P4<E,F,G,H> el)
    Creates a P8 by adding the given element to the current P4
    final boolean
    equals(Object other)
     
    final int
     
    final <X> P4<X,B,C,D>
    map1(F<A,X> f)
    Map the first element of the product.
    final <X> P4<A,X,C,D>
    map2(F<B,X> f)
    Map the second element of the product.
    final <X> P4<A,B,X,D>
    map3(F<C,X> f)
    Map the third element of the product.
    final <X> P4<A,B,C,X>
    map4(F<D,X> f)
    Map the fourth element of the product.
    final P4<A,B,C,D>
    Provides a memoising P4 that remembers its values.
    final String
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • P4

      public P4()
  • Method Details

    • _1

      public abstract A _1()
      Access the first element of the product.
      Returns:
      The first element of the product.
    • _2

      public abstract B _2()
      Access the second element of the product.
      Returns:
      The second element of the product.
    • _3

      public abstract C _3()
      Access the third element of the product.
      Returns:
      The third element of the product.
    • _4

      public abstract D _4()
      Access the fourth element of the product.
      Returns:
      The fourth element of the product.
    • map1

      public final <X> P4<X,B,C,D> map1(F<A,X> f)
      Map the first element of the product.
      Parameters:
      f - The function to map with.
      Returns:
      A product with the given function applied.
    • map2

      public final <X> P4<A,X,C,D> map2(F<B,X> f)
      Map the second element of the product.
      Parameters:
      f - The function to map with.
      Returns:
      A product with the given function applied.
    • map3

      public final <X> P4<A,B,X,D> map3(F<C,X> f)
      Map the third element of the product.
      Parameters:
      f - The function to map with.
      Returns:
      A product with the given function applied.
    • map4

      public final <X> P4<A,B,C,X> map4(F<D,X> f)
      Map the fourth element of the product.
      Parameters:
      f - The function to map with.
      Returns:
      A product with the given function applied.
    • _1_

      public final P1<A> _1_()
      Returns the 1-product projection over the first element.
      Returns:
      the 1-product projection over the first element.
    • _2_

      public final P1<B> _2_()
      Returns the 1-product projection over the second element.
      Returns:
      the 1-product projection over the second element.
    • _3_

      public final P1<C> _3_()
      Returns the 1-product projection over the third element.
      Returns:
      the 1-product projection over the third element.
    • _4_

      public final P1<D> _4_()
      Returns the 1-product projection over the fourth element.
      Returns:
      the 1-product projection over the fourth element.
    • append

      public final <E> P5<A,B,C,D,E> append(E el)
      Creates a P5 by adding the given element to the current P4
      Parameters:
      el - the element to append
      Returns:
      A P5 containing the original P4 with the extra element added at the end
    • append

      public final <E, F> P6<A,B,C,D,E,F> append(P2<E,F> el)
      Creates a P6 by adding the given element to the current P4
      Parameters:
      el - the element to append
      Returns:
      A P6 containing the original P4 with the extra element added at the end
    • append

      public final <E, F, G> P7<A,B,C,D,E,F,G> append(P3<E,F,G> el)
      Creates a P7 by adding the given element to the current P4
      Parameters:
      el - the element to append
      Returns:
      A P7 containing the original P4 with the extra element added at the end
    • append

      public final <E, F, G, H> P8<A,B,C,D,E,F,G,H> append(P4<E,F,G,H> el)
      Creates a P8 by adding the given element to the current P4
      Parameters:
      el - the element to append
      Returns:
      A P8 containing the original P4 with the extra element added at the end
    • memo

      public final P4<A,B,C,D> memo()
      Provides a memoising P4 that remembers its values.
      Returns:
      A P4 that calls this P4 once for any given element and remembers the value for subsequent calls.
    • __1

      public static <A, B, C, D> F<P4<A,B,C,D>,A> __1()
      Returns a function that returns the first element of a product.
      Returns:
      A function that returns the first element of a product.
    • __2

      public static <A, B, C, D> F<P4<A,B,C,D>,B> __2()
      Returns a function that returns the second element of a product.
      Returns:
      A function that returns the second element of a product.
    • __3

      public static <A, B, C, D> F<P4<A,B,C,D>,C> __3()
      Returns a function that returns the third element of a product.
      Returns:
      A function that returns the third element of a product.
    • __4

      public static <A, B, C, D> F<P4<A,B,C,D>,D> __4()
      Returns a function that returns the fourth element of a product.
      Returns:
      A function that returns the fourth element of a product.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • equals

      public final boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object