<commit_before>/**
 * 
 */
package org.verapdf.pdfa.validators;

import org.verapdf.pdfa.PDFAValidator;
import org.verapdf.pdfa.flavours.PDFAFlavour;
import org.verapdf.pdfa.validation.Profiles;
import org.verapdf.pdfa.validation.ValidationProfile;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public final class Validators {
    private Validators() {

    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param flavour
     *            the PDF/A Flavour
     * @param logSuccess
     * @return
     *
     */
    public static PDFAValidator createValidator(PDFAFlavour flavour,
            boolean logSuccess) {
        if (flavour == null)
            throw new IllegalArgumentException(
                    "Parameter (PDFAFlavour flavour) cannot be null.");
        return createValidator(Profiles.getVeraProfileDirectory()
                .getValidationProfileByFlavour(flavour), logSuccess);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @param logSuccess
     * @return validation info structure
     */
    public static PDFAValidator createValidator(
            final ValidationProfile profile, boolean logSuccess) {
        if (profile == null)
            throw new IllegalArgumentException(
                    "Parameter (ValidationProfile profile) cannot be null.");
        return new BaseValidator(profile, logSuccess);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @param logSuccess
     * @param maxFailures
     * @return validation info structure
     */
    public static PDFAValidator createValidator(
            final ValidationProfile profile, boolean logSuccess,
            final int maxFailures) {
        if (profile == null)
            throw new IllegalArgumentException(
                    "Parameter (ValidationProfile profile) cannot be null.");
        return new FastFailValidator(profile, logSuccess, maxFailures);
    }
}<commit_msg>Added new validator factory methods.<commit_after>/**
 * 
 */
package org.verapdf.pdfa.validators;

import org.verapdf.pdfa.PDFAValidator;
import org.verapdf.pdfa.flavours.PDFAFlavour;
import org.verapdf.pdfa.validation.Profiles;
import org.verapdf.pdfa.validation.ValidationProfile;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 *
 */
public final class Validators {
    private Validators() {

    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param flavour
     *            the PDF/A Flavour
     * @param logSuccess
     * @return
     *
     */
    public static PDFAValidator createValidator(PDFAFlavour flavour,
            boolean logSuccess) {
        if (flavour == null)
            throw new IllegalArgumentException(
                    "Parameter (PDFAFlavour flavour) cannot be null.");
        return createValidator(Profiles.getVeraProfileDirectory()
                .getValidationProfileByFlavour(flavour), logSuccess);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @return validation info structure
     */
    public static PDFAValidator createValidator(final ValidationProfile profile) {
        return createValidator(profile, false);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @param logSuccess
     * @return validation info structure
     */
    public static PDFAValidator createValidator(
            final ValidationProfile profile, boolean logSuccess) {
        if (profile == null)
            throw new IllegalArgumentException(
                    "Parameter (ValidationProfile profile) cannot be null.");
        return new BaseValidator(profile, logSuccess);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @param logSuccess
     * @param maxFailures
     * @return validation info structure
     */
    public static PDFAValidator createValidator(
            final ValidationProfile profile, final int maxFailures) {
        return createValidator(profile, false, maxFailures);
    }

    /**
     * Generates validation info for objects with root {@code root} and
     * validation profile structure {@code validationProfile}
     * <p/>
     * This method doesn't need to parse validation profile (it works faster
     * than those ones, which parses profile).
     * 
     * @param profile
     * @param logSuccess
     * @param maxFailures
     * @return validation info structure
     */
    public static PDFAValidator createValidator(
            final ValidationProfile profile, boolean logSuccess,
            final int maxFailures) {
        if (profile == null)
            throw new IllegalArgumentException(
                    "Parameter (ValidationProfile profile) cannot be null.");
        if (maxFailures > 0)
            return new FastFailValidator(profile, logSuccess, maxFailures);
        return createValidator(profile, logSuccess);
    }
}
{'fraction_non_alphanumeric': 0.0827124828949369, 'fraction_numerical': 0.0001520450053215752, 'mean_word_length': 2.5595238095238093, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 20, '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': '4938816', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1604, 'n_words': 565}