initial revision
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2415 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
881e2ef638
commit
95893ab9e3
|
@ -0,0 +1,38 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 IBM Corporation.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.ibm.wala.util.collections;
|
||||
|
||||
/**
|
||||
* A filter "A or B"
|
||||
*
|
||||
* @author sjfink
|
||||
*/
|
||||
public class OrFilter<T> implements Filter<T> {
|
||||
|
||||
public static <T> OrFilter<T> createOrFilter(Filter<T> a, Filter<T> b) {
|
||||
assert a != null;
|
||||
assert b != null;
|
||||
return new OrFilter<T>(a, b);
|
||||
}
|
||||
|
||||
private final Filter<T> a;
|
||||
private final Filter<T> b;
|
||||
|
||||
private OrFilter(Filter<T> a, Filter<T> b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public boolean accepts(T o) {
|
||||
return a.accepts(o) || b.accepts(o);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue