<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anarres.graphviz.builder;

import com.google.common.base.Predicate;
import javax.annotation.Nonnull;

/**
 *
 * @author shevek
 */
public abstract class GraphVizScopePredicate implements Predicate<GraphVizScope> {

    @Nonnull
    public static GraphVizScopePredicate all() {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                return true;
            }
        };
    }

    @Nonnull
    public static GraphVizScopePredicate include(final Class<? extends GraphVizScope>... types) {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                for (Class<? extends GraphVizScope> type : types)
                    if (type.isInstance(t))
                        return true;
                return false;
            }
        };
    }

    @Nonnull
    public static GraphVizScopePredicate exclude(final Class<? extends GraphVizScope>... types) {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                for (Class<? extends GraphVizScope> type : types)
                    if (type.isInstance(t))
                        return false;
                return true;
            }
        };
    }
}
<commit_msg>Apply SafeVarargs to GraphVizScopePredicate.<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anarres.graphviz.builder;

import com.google.common.base.Predicate;
import javax.annotation.Nonnull;

/**
 *
 * @author shevek
 */
public abstract class GraphVizScopePredicate implements Predicate<GraphVizScope> {

    @Nonnull
    public static GraphVizScopePredicate all() {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                return true;
            }
        };
    }

    @Nonnull
    @SafeVarargs
    public static GraphVizScopePredicate include(final Class<? extends GraphVizScope>... types) {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                for (Class<? extends GraphVizScope> type : types)
                    if (type.isInstance(t))
                        return true;
                return false;
            }
        };
    }

    @Nonnull
    @SafeVarargs
    public static GraphVizScopePredicate exclude(final Class<? extends GraphVizScope>... types) {
        return new GraphVizScopePredicate() {
            @Override
            public boolean apply(GraphVizScope t) {
                for (Class<? extends GraphVizScope> type : types)
                    if (type.isInstance(t))
                        return false;
                return true;
            }
        };
    }
}

{'fraction_non_alphanumeric': 0.0804369414101291, 'fraction_numerical': 0.0, 'mean_word_length': 1.8375586854460093, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1377909', 'n_tokens_mistral': 803, 'n_tokens_neox': 778, 'n_words': 209}