<commit_before>package io.dummymaker.factory.impl;

import io.dummymaker.factory.IGenerateFactory;
import io.dummymaker.generator.IGenerator;
import io.dummymaker.util.BasicCollectionUtils;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.List;
import java.util.logging.Logger;

/**
 * Basic core implementation of generate factory with suitable find methods implementation
 *
 * @see IGenerateFactory
 *
 * @author GoodforGod
 * @since 08.03.2018
 */
public abstract class BasicGenerateFactory<T extends IGenerator> implements IGenerateFactory<T> {

    protected static final Logger logger = Logger.getLogger(BasicGenerateFactory.class.getName());

    protected final Class<? extends Annotation> suitableAnnotation;

    public BasicGenerateFactory(final Class<? extends Annotation> suitableAnnotation) {
        if(suitableAnnotation == null)
            throw new NullPointerException("Annotation can not be nullable");

        this.suitableAnnotation = suitableAnnotation;
    }

    @Override
    public boolean isSuitable(final Annotation annotation) {
        return (annotation != null && annotation.getClass().equals(suitableAnnotation));
    }

    @Override
    public Annotation findSuitable(final List<Annotation> annotations) {
        return (BasicCollectionUtils.isEmpty(annotations))
                ? null
                : annotations.stream()
                        .filter(a -> a.annotationType().equals(suitableAnnotation))
                        .findFirst().orElse(null);
    }

    @Override<commit_msg>Generate Factory minor fix<commit_after>package io.dummymaker.factory.impl;

import io.dummymaker.factory.IGenerateFactory;
import io.dummymaker.generator.IGenerator;
import io.dummymaker.util.BasicCollectionUtils;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.List;
import java.util.logging.Logger;

/**
 * Basic core implementation of generate factory with suitable find methods implementation
 *
 * @see IGenerateFactory
 *
 * @author GoodforGod
 * @since 08.03.2018
 */
public abstract class BasicGenerateFactory<T extends IGenerator> implements IGenerateFactory<T> {

    protected static final Logger logger = Logger.getLogger(BasicGenerateFactory.class.getName());

    protected final Class<? extends Annotation> suitableAnnotation;

    public BasicGenerateFactory(final Class<? extends Annotation> suitableAnnotation) {
        if(suitableAnnotation == null)
            throw new NullPointerException("Annotation can not be nullable");

        this.suitableAnnotation = suitableAnnotation;
    }

    @Override
    public boolean isSuitable(final Annotation annotation) {
        return (annotation != null && annotation.annotationType().equals(suitableAnnotation));
    }

    @Override
    public Annotation findSuitable(final List<Annotation> annotations) {
        return (BasicCollectionUtils.isEmpty(annotations))
                ? null
                : annotations.stream()
                        .filter(a -> a.annotationType().equals(suitableAnnotation))
                        .findFirst().orElse(null);
    }

    @Override
{'fraction_non_alphanumeric': 0.08904325860435744, 'fraction_numerical': 0.0050520997789706345, 'mean_word_length': 3.604651162790698, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '2276653', 'n_tokens_mistral': 817, 'n_tokens_neox': 769, 'n_words': 190}