Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84d49aa8 authored by Adam He's avatar Adam He Committed by Android (Google) Code Review
Browse files

Merge "Added 7th argument to pooled lambdas"

parents a737061a c4f03f3a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4117,6 +4117,8 @@ com.android.internal.util.StateMachine$SmHandler$StateInfo
com.android.internal.util.VirtualRefBasePtr
com.android.internal.util.XmlUtils
com.android.internal.util.XmlUtils$WriteMapCallback
com.android.internal.util.function.HeptConsumer
com.android.internal.util.function.HeptFunction
com.android.internal.util.function.HexConsumer
com.android.internal.util.function.HexFunction
com.android.internal.util.function.QuadConsumer
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * 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.
 */

package com.android.internal.util.function;

import java.util.function.Consumer;

/**
 * A 7-argument {@link Consumer}
 *
 * @hide
 */
public interface HeptConsumer<A, B, C, D, E, F, G> {
    void accept(A a, B b, C c, D d, E e, F f, G g);
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * 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.
 */

package com.android.internal.util.function;

import java.util.function.Function;

/**
 * A 7-argument {@link Function}
 *
 * @hide
 */
public interface HeptFunction<A, B, C, D, E, F, G, R> {
    R apply(A a, B b, C c, D d, E e, F f, G g);
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * 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.
 */

package com.android.internal.util.function;

import java.util.function.Predicate;

/**
 * A 7-argument {@link Predicate}
 *
 * @hide
 */
public interface HeptPredicate<A, B, C, D, E, F, G> {
    boolean test(A a, B b, C c, D d, E e, F f, G g);
}
+38 −24
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.internal.util.function.pooled;

import com.android.internal.util.FunctionalUtils.ThrowingRunnable;
import com.android.internal.util.FunctionalUtils.ThrowingSupplier;
import com.android.internal.util.function.HeptConsumer;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.HexConsumer;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.QuadConsumer;
@@ -37,59 +39,61 @@ import java.util.function.Function;
 *
 * @hide
 */
abstract class OmniFunction<A, B, C, D, E, F, R> implements
abstract class OmniFunction<A, B, C, D, E, F, G, R> implements
        PooledFunction<A, R>, BiFunction<A, B, R>, TriFunction<A, B, C, R>,
        QuadFunction<A, B, C, D, R>, QuintFunction<A, B, C, D, E, R>,
        HexFunction<A, B, C, D, E, F, R>, PooledConsumer<A>, BiConsumer<A, B>,
        TriConsumer<A, B, C>, QuadConsumer<A, B, C, D>, QuintConsumer<A, B, C, D, E>,
        HexConsumer<A, B, C, D, E, F>, PooledPredicate<A>, BiPredicate<A, B>,
        HexFunction<A, B, C, D, E, F, R>, HeptFunction<A, B, C, D, E, F, G, R>,
        PooledConsumer<A>, BiConsumer<A, B>, TriConsumer<A, B, C>, QuadConsumer<A, B, C, D>,
        QuintConsumer<A, B, C, D, E>, HexConsumer<A, B, C, D, E, F>,
        HeptConsumer<A, B, C, D, E, F, G>,
        PooledPredicate<A>, BiPredicate<A, B>,
        PooledSupplier<R>, PooledRunnable, ThrowingRunnable, ThrowingSupplier<R>,
        PooledSupplier.OfInt, PooledSupplier.OfLong, PooledSupplier.OfDouble {

    abstract R invoke(A a, B b, C c, D d, E e, F f);
    abstract R invoke(A a, B b, C c, D d, E e, F f, G g);

    @Override
    public R apply(A o, B o2) {
        return invoke(o, o2, null, null, null, null);
        return invoke(o, o2, null, null, null, null, null);
    }

    @Override
    public R apply(A o) {
        return invoke(o, null, null, null, null, null);
        return invoke(o, null, null, null, null, null, null);
    }

    abstract public <V> OmniFunction<A, B, C, D, E, F, V> andThen(
    public abstract <V> OmniFunction<A, B, C, D, E, F, G, V> andThen(
            Function<? super R, ? extends V> after);
    abstract public OmniFunction<A, B, C, D, E, F, R> negate();
    public abstract OmniFunction<A, B, C, D, E, F, G, R> negate();

    @Override
    public void accept(A o, B o2) {
        invoke(o, o2, null, null, null, null);
        invoke(o, o2, null, null, null, null, null);
    }

    @Override
    public void accept(A o) {
        invoke(o, null, null, null, null, null);
        invoke(o, null, null, null, null, null, null);
    }

    @Override
    public void run() {
        invoke(null, null, null, null, null, null);
        invoke(null, null, null, null, null, null, null);
    }

    @Override
    public R get() {
        return invoke(null, null, null, null, null, null);
        return invoke(null, null, null, null, null, null, null);
    }

    @Override
    public boolean test(A o, B o2) {
        return (Boolean) invoke(o, o2, null, null, null, null);
        return (Boolean) invoke(o, o2, null, null, null, null, null);
    }

    @Override
    public boolean test(A o) {
        return (Boolean) invoke(o, null, null, null, null, null);
        return (Boolean) invoke(o, null, null, null, null, null, null);
    }

    @Override
@@ -104,42 +108,52 @@ abstract class OmniFunction<A, B, C, D, E, F, R> implements

    @Override
    public R apply(A a, B b, C c) {
        return invoke(a, b, c, null, null, null);
        return invoke(a, b, c, null, null, null, null);
    }

    @Override
    public void accept(A a, B b, C c) {
        invoke(a, b, c, null, null, null);
        invoke(a, b, c, null, null, null, null);
    }

    @Override
    public R apply(A a, B b, C c, D d) {
        return invoke(a, b, c, d, null, null);
        return invoke(a, b, c, d, null, null, null);
    }

    @Override
    public R apply(A a, B b, C c, D d, E e) {
        return invoke(a, b, c, d, e, null);
        return invoke(a, b, c, d, e, null, null);
    }

    @Override
    public R apply(A a, B b, C c, D d, E e, F f) {
        return invoke(a, b, c, d, e, f);
        return invoke(a, b, c, d, e, f, null);
    }

    @Override
    public R apply(A a, B b, C c, D d, E e, F f, G g) {
        return invoke(a, b, c, d, e, f, g);
    }

    @Override
    public void accept(A a, B b, C c, D d) {
        invoke(a, b, c, d, null, null);
        invoke(a, b, c, d, null, null, null);
    }

    @Override
    public void accept(A a, B b, C c, D d, E e) {
        invoke(a, b, c, d, e, null);
        invoke(a, b, c, d, e, null, null);
    }

    @Override
    public void accept(A a, B b, C c, D d, E e, F f) {
        invoke(a, b, c, d, e, f);
        invoke(a, b, c, d, e, f, null);
    }

    @Override
    public void accept(A a, B b, C c, D d, E e, F f, G g) {
        invoke(a, b, c, d, e, f, g);
    }

    @Override
@@ -153,5 +167,5 @@ abstract class OmniFunction<A, B, C, D, E, F, R> implements
    }

    @Override
    abstract public OmniFunction<A, B, C, D, E, F, R> recycleOnUse();
    public abstract OmniFunction<A, B, C, D, E, F, G, R> recycleOnUse();
}
Loading