<commit_before>/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you 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 org.apache.isis.applib.filter;

import com.google.common.base.Predicate;

/**
 * @deprecated - use {@link com.google.common.base.Predicate} and {@link com.google.common.base.Predicates} instead.
 */
@Deprecated
public final class Predicates {

    private Predicates() {
    }

    public static <T> Predicate<T> and(final Predicate<T>... predicates) {
        return new Predicate<T>() {
            @Override
            public boolean apply(final T f) {
                for(final Predicate<T> predicate : predicates) {
                    if(!predicate.apply(f)) {
                        return false;
                    }
                }
                return true;
            }
        };
    }

    public static <T> Predicate<T> or(final Predicate<T>... predicates) {
        return new Predicate<T>() {
            @Override
            public boolean apply(final T f) {
                for(final Predicate<T> predicate : predicates) {
                    if(predicate.apply(f)) {
                        return true;
                    }
                }
                return false;
            }
        };
    }

    public static <T> Predicate<T> not(final Predicate<T> f1) {
        return new Predicate<T>() {
            @Override
            public boolean apply(final T f) {
                return !f1.apply(f);
            }
        };
    }

    public static <T> Predicate<T> any() {
        return com.google.common.base.Predicates.alwaysTrue();
    }

    public final static <T> Predicate<T> anyOfType(final Class<T> clazz) {
        return any();
    }

    public static <T> Predicate<T> none() {
        return com.google.common.base.Predicates.alwaysFalse();
    }


}
<commit_msg>ISIS-1742: refactors applib.filter.Predicate#and, #or, #not to the guava equivs<commit_after>/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you 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 org.apache.isis.applib.filter;

import com.google.common.base.Predicate;

/**
 * @deprecated - use {@link com.google.common.base.Predicate} and {@link com.google.common.base.Predicates} instead.
 */
@Deprecated
public final class Predicates {

    private Predicates() {
    }

    public static <T> Predicate<T> and(final Predicate<T>... predicates) {
        return com.google.common.base.Predicates.and(predicates);
    }

    public static <T> Predicate<T> or(final Predicate<T>... predicates) {
        return com.google.common.base.Predicates.or(predicates);
    }

    public static <T> Predicate<T> not(final Predicate<T> f1) {
        return com.google.common.base.Predicates.not(f1);
    }

    public static <T> Predicate<T> any() {
        return com.google.common.base.Predicates.alwaysTrue();
    }

    public final static <T> Predicate<T> anyOfType(final Class<T> clazz) {
        return any();
    }

    public static <T> Predicate<T> none() {
        return com.google.common.base.Predicates.alwaysFalse();
    }


}

{'fraction_non_alphanumeric': 0.09951456310679611, 'fraction_numerical': 0.00353045013239188, 'mean_word_length': 2.4159758854559157, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5013578', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1259, 'n_words': 415}