All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vavr.Patterns Maven / Gradle / Ivy

There is a newer version: 1.0.0-alpha-4
Show newest version
/* ____  ______________  ________________________  __________
 * \   \/   /      \   \/   /   __/   /      \   \/   /      \
 *  \______/___/\___\______/___/_____/___/\___\______/___/\___\
 *
 * Copyright 2019 Vavr, http://vavr.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// @formatter:off
// CHECKSTYLE:OFF
package io.vavr;

import io.vavr.API.Match.*;
import io.vavr.collection.List;
import io.vavr.concurrent.Future;
import io.vavr.control.*;

/**
 * @deprecated Will be removed in the next major version, along with VAVR's pattern matching, in favor of Java's native pattern matching.
 */
@Deprecated
public final class Patterns {

    private Patterns() {
    }

    public static final Pattern0 $Tuple0 = Pattern0.of(Tuple0.class);

    public static  Pattern1, _1> $Tuple1(Pattern<_1, ?> p1) {
        return Pattern1.of(Tuple1.class, p1, io.vavr.$::Tuple1);
    }

    public static  Pattern2, _1, _2> $Tuple2(Pattern<_1, ?> p1, Pattern<_2, ?> p2) {
        return Pattern2.of(Tuple2.class, p1, p2, io.vavr.$::Tuple2);
    }

    public static  Pattern3, _1, _2, _3> $Tuple3(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3) {
        return Pattern3.of(Tuple3.class, p1, p2, p3, io.vavr.$::Tuple3);
    }

    public static  Pattern4, _1, _2, _3, _4> $Tuple4(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3, Pattern<_4, ?> p4) {
        return Pattern4.of(Tuple4.class, p1, p2, p3, p4, io.vavr.$::Tuple4);
    }

    public static  Pattern5, _1, _2, _3, _4, _5> $Tuple5(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3, Pattern<_4, ?> p4, Pattern<_5, ?> p5) {
        return Pattern5.of(Tuple5.class, p1, p2, p3, p4, p5, io.vavr.$::Tuple5);
    }

    public static  Pattern6, _1, _2, _3, _4, _5, _6> $Tuple6(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3, Pattern<_4, ?> p4, Pattern<_5, ?> p5, Pattern<_6, ?> p6) {
        return Pattern6.of(Tuple6.class, p1, p2, p3, p4, p5, p6, io.vavr.$::Tuple6);
    }

    public static  Pattern7, _1, _2, _3, _4, _5, _6, _7> $Tuple7(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3, Pattern<_4, ?> p4, Pattern<_5, ?> p5, Pattern<_6, ?> p6, Pattern<_7, ?> p7) {
        return Pattern7.of(Tuple7.class, p1, p2, p3, p4, p5, p6, p7, io.vavr.$::Tuple7);
    }

    public static  Pattern8, _1, _2, _3, _4, _5, _6, _7, _8> $Tuple8(Pattern<_1, ?> p1, Pattern<_2, ?> p2, Pattern<_3, ?> p3, Pattern<_4, ?> p4, Pattern<_5, ?> p5, Pattern<_6, ?> p6, Pattern<_7, ?> p7, Pattern<_8, ?> p8) {
        return Pattern8.of(Tuple8.class, p1, p2, p3, p4, p5, p6, p7, p8, io.vavr.$::Tuple8);
    }

    public static > Pattern2, _1, _2> $Cons(Pattern<_1, ?> p1, Pattern<_2, ?> p2) {
        return Pattern2.of(List.Cons.class, p1, p2, io.vavr.$::Cons);
    }

    public static  Pattern0> $Nil() {
        return Pattern0.of(List.Nil.class);
    }

    public static >> Pattern1, _1> $Future(Pattern<_1, ?> p1) {
        return Pattern1.of(Future.class, p1, io.vavr.$::Future);
    }

    public static  Pattern1, _1> $Right(Pattern<_1, ?> p1) {
        return Pattern1.of(Either.Right.class, p1, io.vavr.$::Right);
    }

    public static  Pattern1, _1> $Left(Pattern<_1, ?> p1) {
        return Pattern1.of(Either.Left.class, p1, io.vavr.$::Left);
    }

    public static  Pattern1, _1> $Some(Pattern<_1, ?> p1) {
        return Pattern1.of(Option.Some.class, p1, io.vavr.$::Some);
    }

    public static  Pattern0> $None() {
        return Pattern0.of(Option.None.class);
    }

    public static  Pattern1, _1> $Success(Pattern<_1, ?> p1) {
        return Pattern1.of(Try.Success.class, p1, io.vavr.$::Success);
    }

    public static  Pattern1, _1> $Failure(Pattern<_1, ?> p1) {
        return Pattern1.of(Try.Failure.class, p1, io.vavr.$::Failure);
    }

    public static  Pattern1, _1> $Valid(Pattern<_1, ?> p1) {
        return Pattern1.of(Validation.Valid.class, p1, io.vavr.$::Valid);
    }

    public static  Pattern1, _1> $Invalid(Pattern<_1, ?> p1) {
        return Pattern1.of(Validation.Invalid.class, p1, io.vavr.$::Invalid);
    }

}
// CHECKSTYLE:ON
// @formatter:on




© 2015 - 2024 Weber Informatics LLC | Privacy Policy