// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// public interface Case<T, R> {
// 
//     Optional<R> unapply(T t);
// 
//     interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//         static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
//     interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//         static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//     static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//         return aCase::unapply;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//     static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//         return aCase::unapply;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/utils/Functions.java
// public interface Function2<A, B, R> {
//     R apply(A a, B b);
// }
// 
// Path: src/main/java/org/smallibs/suitcase/utils/Pair.java
// public class Pair<T1, T2> {
// 
//     public final T1 _1;
//     public final T2 _2;
// 
//     public Pair(T1 _1, T2 _2) {
//         this._1 = _1;
//         this._2 = _2;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Result.java
// public static <R> WithoutCapture<R> success(R term) {
//     return new WithoutCapture<>(term);
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Result.java
// public static <C> WithCapture<C> successWithCapture(C result) {
//     return new WithCapture<>(result);
// }


import org.smallibs.suitcase.cases.Case;
import org.smallibs.suitcase.cases.Case.WithCapture;
import org.smallibs.suitcase.cases.Case.WithoutCapture;
import org.smallibs.suitcase.utils.Functions.Function2;
import org.smallibs.suitcase.utils.Pair;
import java.util.Optional;
import java.util.function.Function;
import static org.smallibs.suitcase.cases.Result.success;
import static org.smallibs.suitcase.cases.Result.successWithCapture;
        this.predicate = predicate;
        this.compute1 = compute1;
        this.compute2 = compute2;
    }

    public <C1, C2> WithoutCapture<P, Pair<C1, C2>> $(WithoutCapture<E1, C1> aCase1, WithoutCapture<E2, C2> aCase2) {
        return WithoutCapture.adapt(new Pattern<>(
                (c1, c2) -> success(new Pair<>(c1.resultValue(), c2.resultValue())),
                aCase1,
                aCase2));
    }

    public <C1, C2> WithCapture<P, C1> $(WithCapture<E1, C1> aCase1, WithoutCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
                (c1, c2) -> c1,
                aCase1,
                aCase2)
        );
    }

    public <C1, C2> WithCapture<P, C2> $(WithoutCapture<E1, C1> aCase1, WithCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
                (c1, c2) -> c2,
                aCase1,
                aCase2)
        );
    }

    public <C1, C2> WithCapture<P, Pair<C1, C2>> $(WithCapture<E1, C1> aCase1, WithCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// public interface Case<T, R> {
// 
//     Optional<R> unapply(T t);
// 
//     interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//         static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
//     interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//         static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//     static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//         return aCase::unapply;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//     static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//         return aCase::unapply;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/utils/Functions.java
// public interface Function2<A, B, R> {
//     R apply(A a, B b);
// }
// 
// Path: src/main/java/org/smallibs/suitcase/utils/Pair.java
// public class Pair<T1, T2> {
// 
//     public final T1 _1;
//     public final T2 _2;
// 
//     public Pair(T1 _1, T2 _2) {
//         this._1 = _1;
//         this._2 = _2;
//     }
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Result.java
// public static <R> WithoutCapture<R> success(R term) {
//     return new WithoutCapture<>(term);
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/Result.java
// public static <C> WithCapture<C> successWithCapture(C result) {
//     return new WithCapture<>(result);
// }


// Path: src/main/java/org/smallibs/suitcase/cases/core/Case2.java
import org.smallibs.suitcase.cases.Case;
import org.smallibs.suitcase.cases.Case.WithCapture;
import org.smallibs.suitcase.cases.Case.WithoutCapture;
import org.smallibs.suitcase.utils.Functions.Function2;
import org.smallibs.suitcase.utils.Pair;
import java.util.Optional;
import java.util.function.Function;
import static org.smallibs.suitcase.cases.Result.success;
import static org.smallibs.suitcase.cases.Result.successWithCapture;

        this.predicate = predicate;
        this.compute1 = compute1;
        this.compute2 = compute2;
    }

    public <C1, C2> WithoutCapture<P, Pair<C1, C2>> $(WithoutCapture<E1, C1> aCase1, WithoutCapture<E2, C2> aCase2) {
        return WithoutCapture.adapt(new Pattern<>(
                (c1, c2) -> success(new Pair<>(c1.resultValue(), c2.resultValue())),
                aCase1,
                aCase2));
    }

    public <C1, C2> WithCapture<P, C1> $(WithCapture<E1, C1> aCase1, WithoutCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
                (c1, c2) -> c1,
                aCase1,
                aCase2)
        );
    }

    public <C1, C2> WithCapture<P, C2> $(WithoutCapture<E1, C1> aCase1, WithCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
                (c1, c2) -> c2,
                aCase1,
                aCase2)
        );
    }

    public <C1, C2> WithCapture<P, Pair<C1, C2>> $(WithCapture<E1, C1> aCase1, WithCapture<E2, C2> aCase2) {
        return WithCapture.adapt(new Pattern<>(
                (c1, c2) -> successWithCapture(new Pair<>(c1.resultValue(), c2.resultValue())),