/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE file.
 */
package org.apache.avalon.util.io;

import java.io.File;
import java.io.FilenameFilter;

/**
 * This takes two file fiters as input. Accepts a selection only if it is 
 * accpetable to both the input filters
 *
 * @author  Harmeet Bedi <harmeet@kodemuse.com>
 */
public class AndFileFilter implements FilenameFilter
{
    private final FilenameFilter filter1;
    private final FilenameFilter filter2;
    public AndFileFilter( FilenameFilter filter1, FilenameFilter filter2 ) 
    {
        this.filter1 = filter1;
        this.filter2 = filter2;
    }

    public boolean accept( File file, final String name ) 
    {
        return filter1.accept(file,name) && filter2.accept(file,name);
    }
}

    
