Interface CoProduct5<A, B, C, D, E, CP5 extends CoProduct5<A,B,C,D,E,?>>
- Type Parameters:
A- the first possible typeB- the second possible typeC- the third possible typeD- the fourth possible typeE- the fifth possible typeCP5- the recursive type of this coproduct (used for embedding)
- All Known Implementing Classes:
Choice5, Choice5._A, Choice5._B, Choice5._C, Choice5._D, Choice5._E
- 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 CoProduct5<A, B, C, D, E, CP5 extends CoProduct5<A,B,C,D,E,?>>
A generalization of the coproduct of five types.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault CoProduct4<A, B, C, D, ? extends CoProduct4<A, B, C, D, ?>> Converge this coproduct down to a lower order coproduct by mapping the last possible type into an earlier possible type.diverge()Diverge this coproduct by introducing another possible type that it could represent.default <R> Rembed(Fn1<? super CP5, ? extends R> aFn, Fn1<? super CP5, ? extends R> bFn, Fn1<? super CP5, ? extends R> cFn, Fn1<? super CP5, ? extends R> dFn, Fn1<? super CP5, ? extends R> eFn) Embed this coproduct inside another value; that is, given morphisms from this coproduct toR, apply the appropriate morphism to this coproduct as a whole.<R> Rmatch(Fn1<? super A, ? extends R> aFn, Fn1<? super B, ? extends R> bFn, Fn1<? super C, ? extends R> cFn, Fn1<? super D, ? extends R> dFn, Fn1<? super E, ? extends R> eFn) Type-safe convergence requiring a match against all potential types.project()Project this coproduct onto a product.projectA()Convenience method for projecting this coproduct onto a product and then extracting the first slot value.projectB()Convenience method for projecting this coproduct onto a product and then extracting the second slot value.projectC()Convenience method for projecting this coproduct onto a product and then extracting the third slot value.projectD()Convenience method for projecting this coproduct onto a product and then extracting the fourth slot value.projectE()Convenience method for projecting this coproduct onto a product and then extracting the fifth slot value.
-
Method Details
-
match
<R> R match(Fn1<? super A, ? extends R> aFn, Fn1<? super B, ? extends R> bFn, Fn1<? super C, ? extends R> cFn, Fn1<? super D, ? extends R> dFn, Fn1<? super E, ? extends R> eFn) Type-safe convergence requiring a match against all potential types.- Type Parameters:
R- result type- Parameters:
aFn- morphismA -> RbFn- morphismB -> RcFn- morphismC -> RdFn- morphismD -> ReFn- morphismE -> R- Returns:
- the result of applying the appropriate morphism from whichever type is represented by this coproduct to R
- See Also:
-
diverge
-
converge
default CoProduct4<A, B, C, D, ? extends CoProduct4<A,B, convergeC, D, ?>> (Fn1<? super E, ? extends CoProduct4<A, B, C, D, ?>> convergenceFn) Converge this coproduct down to a lower order coproduct by mapping the last possible type into an earlier possible type.- Parameters:
convergenceFn- morphismE ->CoProduct4<A, B, C, D>- Returns:
- a
CoProduct4<A, B, C, D>
-
project
-
projectA
-
projectB
-
projectC
-
projectD
-
projectE
-
embed
default <R> R embed(Fn1<? super CP5, ? extends R> aFn, Fn1<? super CP5, ? extends R> bFn, Fn1<? super CP5, ? extends R> cFn, Fn1<? super CP5, ? extends R> dFn, Fn1<? super CP5, ? extends R> eFn) Embed this coproduct inside another value; that is, given morphisms from this coproduct toR, apply the appropriate morphism to this coproduct as a whole. Likematch(Fn1, Fn1, Fn1, Fn1, Fn1), but without unwrapping the value.- Type Parameters:
R- result type- Parameters:
aFn- morphismA v B v C v D v E -> R, applied in theAcasebFn- morphismA v B v C v D v E -> R, applied in theBcasecFn- morphismA v B v C v D v E -> R, applied in theCcasedFn- morphismA v B v C v D v E -> R, applied in theDcaseeFn- morphismA v B v C v D v E -> R, applied in theEcase- Returns:
- the result of applying the appropriate morphism to this coproduct
-