View Javadoc
1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.util.filter;
5   
6   /**
7    * A logical NEGATION of a Filter.
8    * 
9    * @param <T>
10   *            The underlying type on which the filter applies.
11   */
12  public class NotFilter<T> extends AbstractDelegateFilter<T> {
13  	public NotFilter() {
14  		super();
15  	}
16  
17  	public NotFilter(Filter<T> filter) {
18  		super(filter);
19  	}
20  
21  	public boolean filter(T obj) {
22  		return !filter.filter(obj);
23  	}
24  
25  	public String toString() {
26  		return "not (" + filter + ")";
27  	}
28  }