<commit_before>package com.stevemosley.ftpgrabber.filters;

import com.google.common.collect.ImmutableList;
import org.apache.commons.net.ftp.FTPFile;
import org.springframework.integration.file.filters.AbstractFileListFilter;

import java.util.List;

/**
 * Filter by checking if file name matches a list of Regexes.
 */
public class MultiRegexFTPFileListFilter extends AbstractFileListFilter<FTPFile> {

    private final List<String> regexs;

    public MultiRegexFTPFileListFilter(List<String> regexs) {
        this.regexs = ImmutableList.copyOf(regexs);
    }

    @Override
    protected boolean accept(FTPFile file) {
        String fileName = file.getName();
        for(String current : regexs) {
            if(fileName.matches(current)) {
                return true;
            }
        }
        return false;
    }
}<commit_msg>Filter for FTP files using a Regex.<commit_after>package com.stevemosley.ftpgrabber.filters;

import com.google.common.collect.ImmutableList;
import org.apache.commons.net.ftp.FTPFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.integration.file.filters.AbstractFileListFilter;

import java.util.List;

/**
 * Filter by checking if file name matches a list of Regexes.
 */
public class MultiRegexFTPFileListFilter extends AbstractFileListFilter<FTPFile> {

    private static final Logger LOG = LoggerFactory.getLogger(MultiRegexFTPFileListFilter.class);

    private final List<String> regexs;

    public MultiRegexFTPFileListFilter(List<String> regexs) {
        this.regexs = ImmutableList.copyOf(regexs);
        LOG.info("{}", regexs);
    }

    @Override
    protected boolean accept(FTPFile file) {
        String fileName = file.getName();
        for(String current : regexs) {
            if(fileName.matches(current)) {
                return true;
            }
        }
        return false;
    }
}
{'fraction_non_alphanumeric': 0.09263157894736843, 'fraction_numerical': 0.0010526315789473684, 'mean_word_length': 3.2338530066815143, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1092706', 'n_tokens_mistral': 567, 'n_tokens_neox': 549, 'n_words': 120}