/*
 * FindBugs - Find Bugs in Java programs
 * Copyright (C) 2003-2007 University of Maryland
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package edu.umd.cs.findbugs;

import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import org.dom4j.DocumentException;

/**
 * @author pugh
 */
public class ExcludingHashesBugReporter extends DelegatingBugReporter {
	
	Set<String> excludedHashes = new HashSet<String>();
	/**
     * @param delegate
	 * @throws DocumentException 
	 * @throws IOException 
     */
    public ExcludingHashesBugReporter(BugReporter delegate, String baseline) throws IOException, DocumentException {
	    super(delegate);
		Project project = new Project();
		BugCollection origCollection;
		origCollection = new SortedBugCollection();
		origCollection.readXML(baseline, project);
		for(BugInstance b : origCollection.getCollection())
			excludedHashes.add(b.getInstanceHash());
    }
	@Override
	public void reportBug(BugInstance bugInstance) {
		if (!excludedHashes.contains(bugInstance.getInstanceHash()))
				getDelegate().reportBug(bugInstance);
	}
}

Add delegating bug reporter that filters out bugs that match a known instance hash
Add delegating bug reporter that filters out bugs that match a known instance hash

git-svn-id: e7d6bde23f017c9ff4efd468d79d66def666766b@8957 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3
