Filters { public static Filter removeFilter( Filter baseFilter, Filter targetFilter ){ return STATIC.remove(baseFilter, targetFilter); } Filters();  Filters(org.opengis.filter.FilterFactory2 factory); void setFilterFactory(org.opengis.filter.FilterFactory2 factory); static Filter and( org.opengis.filter.FilterFactory ff, Filter filter1, Filter filter2 ); static Filter or( org.opengis.filter.FilterFactory ff, Filter filter1, Filter filter2 ); Filter duplicate( Filter filter ); static short getExpressionType( org.opengis.filter.expression.Expression experssion ); static short getFilterType( org.opengis.filter.Filter filter ); static int asInt( Expression expr ); static String asString(Expression expr); static double asDouble(Expression expr); static T asType(Expression expr, Class<T> TYPE); static double number(Object value); static T gets(String text, Class<T> TYPE); static String puts(double number); static String puts(Object obj); static String puts(Color color); Filter remove(Filter baseFilter, Filter targetFilter); static Filter removeFilter( Filter baseFilter, Filter targetFilter ); Filter remove(Filter baseFilter, final Filter targetFilter, boolean recurse); static Filter removeFilter(Filter baseFilter, Filter targetFilter, boolean recurse); Set<String> attributeNames( Filter filter ); static String[] attributeNames(Filter filter, final SimpleFeatureType featureType); static Set<PropertyName> propertyNames(Filter filter, final SimpleFeatureType featureType); static Set<PropertyName> propertyNames(Filter filter); static Set<PropertyName> propertyNames(Expression expression,
            final SimpleFeatureType featureType); static Set<PropertyName> propertyNames(Expression expression); static boolean hasChildren( Filter filter ); static ArrayList<Filter> children( Filter filter ); static ArrayList<Filter> children( Filter filter, boolean all ); static T search(Filter filter, Class<T> filterType, String propertyName ); static String findPropertyName(Filter filter); static final int NOTFOUND; }
@Test public void testRemoveFilter() { Filter results = Filters.removeFilter(null, a); assertNull("Start with nothing should end with nothing", results); results = Filters.removeFilter(a, null); assertSame("Existing should be returned with null target", a, results); And base = ff.and(Arrays.asList(new Filter[]{a,b,c})); results = Filters.removeFilter(base, d); assertEquals("Should not change when target not a child", base, results); results = Filters.removeFilter(base, b); And expected = ff.and(a, c); assertEquals(expected, results); results = Filters.removeFilter(results, a); assertEquals(results, c); results = Filters.removeFilter(results, c); assertSame("Include should be returned when same filter", Filter.INCLUDE, results); }