public boolean supports(Class type) { // TODO Auto-generated method stub return super.supports(type); }
public Object visit(ExcludeFilter filter, Object notUsed) { if (fcs.supports(Filter.EXCLUDE)) { preStack.push(filter); } else { postStack.push(filter); } return null; }
/** * @see FilterVisitor#visit(ExcludeFilter, Object) * @param filter the {@link Filter} to visit */ public void visit(ExcludeFilter filter) { if (fcs.supports(Filter.EXCLUDE)) { preStack.push(filter); } else { postStack.push(filter); } }
public Object visit(Id filter, Object notUsed) { if (original == null) original = filter; if (!fcs.supports(filter)) { postStack.push(filter); } else { preStack.push(filter); } return null; }
/** * Determines if the filter type passed in is supported. * * @param type The AbstractFilter type to be tested * @return true if supported, false otherwise. * @deprecated */ public boolean supports(short type) { return supports(convertFilterTypeToMask(type)); }
/** * Determines if the filter passed in is supported. * * @param filter The Filter to be tested. * @return true if supported, false otherwise. */ public boolean supports(org.opengis.filter.Filter filter) { for (Iterator ifunc = functions.iterator(); ifunc.hasNext(); ) { if (((Class) ifunc.next()).isAssignableFrom(filter.getClass())) return true; } if (functions.contains(filter.getClass())) return true; short filterType = Filters.getFilterType(filter); if (filterType == 0) { // unknown type return false; } return supports(filterType); }
Object visitNullNil(Filter filter, Expression e) { if (original == null) original = filter; if (!fcs.supports(PropertyIsNull.class)) { postStack.push(filter); return null; } int i = postStack.size(); e.accept(this, null); if (i < postStack.size()) { postStack.pop(); postStack.push(filter); return null; } preStack.pop(); // null preStack.push(filter); return null; }
public Object visit(PropertyIsLike filter, Object notUsed) { if (original == null) original = filter; if (!fcs.supports(PropertyIsLike.class)) { postStack.push(filter); return null; } int i = postStack.size(); filter.getExpression().accept(this, null); if (i < postStack.size()) { postStack.pop(); postStack.push(filter); return null; } preStack.pop(); // value preStack.push(filter); return null; }
public Object visit(Function expr, Object extraData) { for (int i = 0; i < expr.getParameters().size(); i++) { ((Expression) expr.getParameters().get(i)).accept(this, null); } capable = capable && fcs.supports(expr.getClass()); return null; }
public Object visit(Function expression, Object notUsed) { if (!fcs.supports(expression.getClass())) { postStack.push(expression); return null; } if (expression.getName() == null) { postStack.push(expression); return null; } int i = postStack.size(); int j = preStack.size(); for (int k = 0; k < expression.getParameters().size(); k++) { ((Expression) expression.getParameters().get(i)).accept(this, null); if (i < postStack.size()) { while (j < preStack.size()) preStack.pop(); postStack.pop(); postStack.push(expression); return null; } } while (j < preStack.size()) preStack.pop(); preStack.push(expression); return null; }
public boolean canEncode(Element element, Object value, Map hints) { if ((hints != null) && hints.containsKey(FilterSchema.FILTER_CAP_KEY)) { FilterCapabilities fc = (FilterCapabilities) hints.get(FilterSchema.FILTER_CAP_KEY); FilterCapabilities elementkey = FilterCapabilities.findOperation(element.getName()); if ((elementkey == null) || !fc.supports(elementkey)) { return false; } } return (element.getType() != null) && getName().equals(element.getType().getName()) && value instanceof BinarySpatialOperator; }
protected boolean skipTests(Class<?> fClass) { if (!dataStore.getFilterCapabilities().supports(fClass)) { LOGGER.log( Level.INFO, "Function {0} is not natively supported, skipping test", fClass.getSimpleName()); return true; } return false; } }
private void visitMathExpression(BinaryExpression expression) { expression.getExpression1().accept(this, null); expression.getExpression2().accept(this, null); capable = capable && fcs.supports(expression.getClass()); } }
public void testAdd() { capabilities.addType(FilterType.COMPARE_GREATER_THAN); capabilities.addType(FilterType.COMPARE_LESS_THAN_EQUAL); capabilities.addType(AbstractFilter.NULL); assertTrue(capabilities.supports(AbstractFilter.NULL)); }
public void testTimestampHistogram() throws Exception { // buckets with a size of one day, the function returns an integer from 0 onwards, which // is a zero based bucket number in the bucket sequence FilterFactory ff = dataStore.getFilterFactory(); PropertyName pn = ff.property(aname("last_update")); Date baseDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2016-06-03 00:00:00"); Expression difference = ff.function("dateDifference", pn, ff.literal(baseDate)); int dayInMs = 1000 * 60 * 60 * 24; Expression expression = ff.function("floor", ff.divide(difference, ff.literal(dayInMs))); FilterCapabilities capabilities = dataStore.getFilterCapabilities(); boolean expectOptimized = capabilities.supports(FilterFunction_floor.class) && capabilities.supports(DateDifferenceFunction.class); List<Object[]> value = genericGroupByTestTest(Query.ALL, Aggregate.COUNT, expectOptimized, expression); assertNotNull(value); assertEquals(5, value.size()); checkValueContains(value, "0", "3"); // 2016-06-03 checkValueContains(value, "2", "1"); // 2016-06-05 checkValueContains(value, "3", "2"); // 2016-06-06 checkValueContains(value, "4", "3"); // 2016-06-07 checkValueContains(value, "12", "3"); // 2016-06-15 }
public void testNumericHistogram() throws Exception { // buckets with a size of 100, the function returns an integer from 0 onwards, which // is a zero based bucket number in the bucket sequence FilterFactory ff = dataStore.getFilterFactory(); PropertyName pn = ff.property(aname("energy_consumption")); Expression expression = ff.function("floor", ff.divide(pn, ff.literal(100))); boolean expectOptimized = dataStore.getFilterCapabilities().supports(FilterFunction_floor.class); List<Object[]> value = genericGroupByTestTest(Query.ALL, Aggregate.COUNT, expectOptimized, expression); assertNotNull(value); assertEquals(value.size(), 3); checkValueContains(value, "0", "10"); checkValueContains(value, "1", "1"); checkValueContains(value, "5", "1"); }
public void testSumArea() throws Exception { FilterFactory ff = dataStore.getFilterFactory(); PropertyName p = ff.property(aname("geom")); SumAreaVisitor v = new MySumAreaVisitor(p); dataStore.getFeatureSource(tname("aggregate")).accepts(Query.ALL, v, null); assertEquals( visited, !dataStore.getFilterCapabilities().supports(FilterFunction_area.class)); assertEquals(30.0, v.getResult().toDouble(), 0.01); }