<commit_before>package com.github.kaaveland.tryagain;

public class Retrier {
    public final int times;
    public final DelayStrategy delayStrategy;
    public final ExceptionMatcher exceptionMatcher;

    public static Retrier retryOn(ExceptionMatcher exceptionMatches) {
        return new Retrier(exceptionMatches);
    }

    @SafeVarargs
    public static Retrier retryOn(Class<? extends Exception> ...exceptions) {
        return retryOn(new ExceptionIn(exceptions));
    }

    public Retrier(ExceptionMatcher exceptionMatcher) {
        this(exceptionMatcher, 1, new DelayStrategy() {
            @Override
            public long delay(final int attempt) {
                return 0;
            }
        });
    }

    public Retrier(ExceptionMatcher exceptionMatcher, int times, DelayStrategy delayStrategy) {
        this.exceptionMatcher = exceptionMatcher;
        this.times = times;
        this.delayStrategy = delayStrategy;
    }

    public Retrier times(int times) {
        return new Retrier(exceptionMatcher, times, delayStrategy);
    }

    public Retrier delaying(int delay) {
        return new Retrier(exceptionMatcher, times, new StaticDelayStrategy(delay));
    }

    public Retrier exponentialBackoff(int firstDelay) {
        return new Retrier(exceptionMatcher, times, new ExponentialBackoffStrategy(firstDelay));
    }

    public WrapExceptions wrapExceptions() {
        return new WrapExceptions(this);<commit_msg>Factory method for InstanceOf matcher.<commit_after>package com.github.kaaveland.tryagain;

public class Retrier {
    public final int times;
    public final DelayStrategy delayStrategy;
    public final ExceptionMatcher exceptionMatcher;

    public static Retrier retryOn(ExceptionMatcher exceptionMatches) {
        return new Retrier(exceptionMatches);
    }

    @SafeVarargs
    public static Retrier on(Class<? extends Exception>... exceptions) {
        return new Retrier(new ExceptionIn(exceptions));
    }

    @SafeVarargs
    public static Retrier onInstanceOf(Class<? extends Exception>... exceptions) {
        return new Retrier(new InstancesOf(exceptions));
    }

    public Retrier(ExceptionMatcher exceptionMatcher) {
        this(exceptionMatcher, 1, new DelayStrategy() {
            @Override
            public long delay(final int attempt) {
                return 0;
            }
        });
    }

    public Retrier(ExceptionMatcher exceptionMatcher, int times, DelayStrategy delayStrategy) {
        this.exceptionMatcher = exceptionMatcher;
        this.times = times;
        this.delayStrategy = delayStrategy;
    }

    public Retrier times(int times) {
        return new Retrier(exceptionMatcher, times, delayStrategy);
    }

    public Retrier delaying(int delay) {
        return new Retrier(exceptionMatcher, times, new StaticDelayStrategy(delay));
    }

    public Retrier exponentialBackoff(int firstDelay) {
        return new Retrier(exceptionMatcher, times, new ExponentialBackoffStrategy(firstDelay));
    }

    public WrapExceptions wrapExceptions() {
        return new WrapExceptions(this);
{'fraction_non_alphanumeric': 0.0732258064516129, 'fraction_numerical': 0.0012903225806451613, 'mean_word_length': 3.1072847682119207, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '11272', 'n_tokens_mistral': 790, 'n_tokens_neox': 761, 'n_words': 214}