package vut.msa.utilities;

import java.io.File;
import java.io.FileFilter;

/**
 * Suborovy filter na dokumenty. 
 */
public class DocumentFileFilter implements FileFilter {

    private final String[] acceptedExtensions = new String[]{"pdf", "doc", "docx"};

    /**
     * Metoda filtruje subory podla akceptovanej pripony.
     *
     * @param file nazov suboru
     * @return true, ak je podporovany format; false, ak nie je podporovany
     */
    public boolean accept(File file) {
        for (String extension : acceptedExtensions) {
            if (file.getName().toLowerCase().endsWith(extension)) {
                return true;
            }
        }
        return false;
    }
}
