<commit_before>package com.nikolavp.approval.reporters;

import com.nikolavp.approval.Reporter;

import java.io.File;

/**
 * A reporter that will compose other reportes and use the first one that can approve the objects for verification as per {@link com.nikolavp.approval.Reporter#canApprove(java.io.File)}.
 */
class FirstWorkingReporter implements Reporter {
    private final Reporter[] others;

    FirstWorkingReporter(Reporter... others) {
        this.others = others;
    }

    @Override
    public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                other.notTheSame(oldValue, fileForVerification, newValue, fileForApproval);
                return;
            }
        }
        throw new IllegalStateException("This should never happen. Can approve was not called?!");
    }

    @Override
    public boolean approveNew(byte[] value, File fileForApproval, File fileForVerification) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                return other.approveNew(value, fileForVerification, fileForApproval);
            }
        }
        throw new IllegalStateException("This should never happen. Can approve was not called?!");
    }

    @Override
    public boolean canApprove(File fileForApproval) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                return true;
            }
        }
        return false;
    }
}
<commit_msg>Formatting<commit_after>package com.nikolavp.approval.reporters;

import com.nikolavp.approval.Reporter;

import java.io.File;

/**
 * A reporter that will compose other reporters and use the first one that can approve the objects for verification as
 * per {@link com.nikolavp.approval.Reporter#canApprove(java.io.File)}.
 */
class FirstWorkingReporter implements Reporter {
    private final Reporter[] others;

    FirstWorkingReporter(Reporter... others) {
        this.others = others;
    }

    @Override
    public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                other.notTheSame(oldValue, fileForVerification, newValue, fileForApproval);
                return;
            }
        }
        throw new IllegalStateException("This should never happen. Can approve was not called?!");
    }

    @Override
    public boolean approveNew(byte[] value, File fileForApproval, File fileForVerification) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                return other.approveNew(value, fileForVerification, fileForApproval);
            }
        }
        throw new IllegalStateException("This should never happen. Can approve was not called?!");
    }

    @Override
    public boolean canApprove(File fileForApproval) {
        for (Reporter other : others) {
            if (other.canApprove(fileForApproval)) {
                return true;
            }
        }
        return false;
    }
}

{'fraction_non_alphanumeric': 0.08721109399075501, 'fraction_numerical': 0.0, 'mean_word_length': 2.610678531701891, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4628589', 'n_tokens_mistral': 909, 'n_tokens_neox': 872, 'n_words': 238}