/** * @return PropertyIsGreaterThanOrEqualTo * @throws CQLException */ public PropertyIsGreaterThanOrEqualTo buildGreaterOrEqual() throws CQLException { Expression right = this.resultStack.popExpression(); Expression left = this.resultStack.popExpression(); return filterFactory.greaterOrEqual(left, right); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Expression e1 = (Expression) node.getChildValue(0); Expression e2 = (Expression) node.getChildValue(1); return filterfactory.greaterOrEqual(e1, e2); } }
/** * Builds PropertyIsGreaterThanOrEqualTo begin of period * * @return PropertyIsGreaterThanOrEqualTo * @throws CQLException */ public PropertyIsGreaterThanOrEqualTo buildPropertyIsGTEFirstDate() throws CQLException { Result node = this.resultStack.popResult(); PeriodNode period = (PeriodNode) node.getBuilt(); org.opengis.filter.expression.Literal begin = period.getBeginning(); org.opengis.filter.expression.Expression property = (org.opengis.filter.expression.Expression) resultStack.popExpression(); PropertyIsGreaterThanOrEqualTo filter = filterFactory.greaterOrEqual(property, begin); return filter; }
private Filter toGreaterFilter(FilterFactory ff, Expression variable, Range<T> range) { if (range.isMinIncluded()) { return ff.greaterOrEqual(variable, ff.literal(range.getMinValue())); } else { return ff.greater(variable, ff.literal(range.getMinValue())); } }
filter1 = ff.greaterOrEqual(filter1.getExpression1(), ff.literal(newValue[0]));
public void testFilterByTime() throws Exception { FeatureSource fs = dataStore.getFeatureSource(tname("dates")); FilterFactory ff = dataStore.getFilterFactory(); // greather than or equal to Filter f = ff.greaterOrEqual(ff.property(aname("t")), ff.literal("13:10:12")); assertEquals(3, fs.getCount(new Query(tname("dates"), f))); f = ff.greaterOrEqual( ff.property(aname("t")), ff.literal(new SimpleDateFormat("ss:HH:mm").parse("12:13:10"))); assertEquals(3, fs.getCount(new Query(tname("dates"), f))); } }
private <T> void testOrTouchingRanges(Class<T> type, T value) throws Exception { SimpleFeatureType schema = DataUtilities.createType("test", "a:" + type.getName()); SimplifyingFilterVisitor visitor = new SimplifyingFilterVisitor(); visitor.setRangeSimplicationEnabled(true); visitor.setFeatureType(schema); Filter original = ff.or( ff.greaterOrEqual(ff.property("a"), ff.literal(value)), ff.lessOrEqual(ff.property("a"), ff.literal(value))); Filter simplified = (Filter) original.accept(visitor, null); assertEquals(Filter.INCLUDE, simplified); }
public void testNegateGreaterOrEqual() { Filter f = ff.not(ff.greaterOrEqual(ff.property("prop"), ff.literal(10))); Filter result = (Filter) f.accept(simpleVisitor, null); assertEquals(ff.less(ff.property("prop"), ff.literal(10)), result); // not simplified for complex features result = (Filter) f.accept(complexVisitor, null); assertEquals(f, result); }
public void testNegateLess() { Filter f = ff.not(ff.less(ff.property("prop"), ff.literal(10))); Filter result = (Filter) f.accept(simpleVisitor, null); assertEquals(ff.greaterOrEqual(ff.property("prop"), ff.literal(10)), result); // not simplified for complex features result = (Filter) f.accept(complexVisitor, null); assertEquals(f, result); }
public void testAbs4() throws IOException { if (skipTests(FilterFunction_abs_4.class)) { return; } // intentionally forcing a integer abs (makes no sense, but it's there...) Expression mul = ff.multiply(ff.property(aname("doubleProperty")), ff.literal(-1)); Function func2 = ff.function("abs_4", mul); Filter filter = ff.greaterOrEqual(func2, ff.literal(1)); assertFeatures(fs, filter, tname("ft1") + ".1", tname("ft1") + ".2"); }
private <T> void testAndTouchingRanges(Class<T> type, T value) throws Exception { SimpleFeatureType schema = DataUtilities.createType("test", "a:" + type.getName()); SimplifyingFilterVisitor visitor = new SimplifyingFilterVisitor(); visitor.setRangeSimplicationEnabled(true); visitor.setFeatureType(schema); Filter original = ff.and( ff.greaterOrEqual(ff.property("a"), ff.literal(value)), ff.lessOrEqual(ff.property("a"), ff.literal(value))); Filter simplified = (Filter) original.accept(visitor, null); assertEquals(ff.equal(ff.property("a"), ff.literal(value), false), simplified); }
public void testAbs3() throws IOException { if (skipTests(FilterFunction_abs_3.class)) { return; } // intentionally forcing a integer abs (makes no sense, but it's there...) Expression mul = ff.multiply(ff.property(aname("doubleProperty")), ff.literal(-1)); Function func2 = ff.function("abs_3", mul); Filter filter = ff.greaterOrEqual(func2, ff.literal(1)); assertFeatures(fs, filter, tname("ft1") + ".1", tname("ft1") + ".2"); }
private <T> void testAndOverlappingRangesToBetween(Class<T> type, T min, T mid, T max) throws Exception { SimpleFeatureType schema = DataUtilities.createType("test", "a:" + type.getName()); SimplifyingFilterVisitor visitor = new SimplifyingFilterVisitor(); visitor.setRangeSimplicationEnabled(true); visitor.setFeatureType(schema); // excluding extrema, not possible to turn it into a between filter Filter original = ff.and( Arrays.asList( // (Filter) ff.greaterOrEqual(ff.property("a"), ff.literal(min)), // ff.less(ff.property("a"), ff.literal(max)), // ff.lessOrEqual(ff.property("a"), ff.literal(mid)))); Filter simplified = (Filter) original.accept(visitor, null); assertEquals(ff.between(ff.property("a"), ff.literal(min), ff.literal(mid)), simplified); }
/** * * @return PropertyIsGreaterThanOrEqualTo * @throws CQLException */ public PropertyIsGreaterThanOrEqualTo buildGreaterOrEqual() throws CQLException { Expression right = this.resultStack.popExpression(); Expression left = this.resultStack.popExpression(); return filterFactory.greaterOrEqual(left, right); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Expression e1 = (Expression) node.getChildValue(0); Expression e2 = (Expression) node.getChildValue(1); return filterfactory.greaterOrEqual(e1, e2); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Expression e1 = (Expression) node.getChildValue(0); Expression e2 = (Expression) node.getChildValue(1); return filterfactory.greaterOrEqual(e1, e2); } }
lowBoundFilter = ff.greaterOrEqual(expression, ff.literal(localMin));
public void testSimplifyStaticExclude() { assertEquals(Filter.EXCLUDE, simplify(ff.greater(ff.literal(3), ff.literal(5)))); assertEquals(Filter.EXCLUDE, simplify(ff.greaterOrEqual(ff.literal(3), ff.literal(5)))); assertEquals(Filter.EXCLUDE, simplify(ff.less(ff.literal(5), ff.literal(3)))); assertEquals(Filter.EXCLUDE, simplify(ff.lessOrEqual(ff.literal(5), ff.literal(3)))); assertEquals(Filter.EXCLUDE, simplify(ff.equal(ff.literal(5), ff.literal(3), true))); assertEquals( Filter.EXCLUDE, simplify(ff.between(ff.literal(3), ff.literal(1), ff.literal(2)))); }
public void testSimplifyStaticInclude() { assertEquals(Filter.INCLUDE, simplify(ff.less(ff.literal(3), ff.literal(5)))); assertEquals(Filter.INCLUDE, simplify(ff.lessOrEqual(ff.literal(3), ff.literal(5)))); assertEquals(Filter.INCLUDE, simplify(ff.greater(ff.literal(5), ff.literal(3)))); assertEquals(Filter.INCLUDE, simplify(ff.greaterOrEqual(ff.literal(5), ff.literal(3)))); assertEquals(Filter.INCLUDE, simplify(ff.equal(ff.literal(5), ff.literal(5), true))); assertEquals( Filter.INCLUDE, simplify(ff.between(ff.literal(3), ff.literal(1), ff.literal(4)))); }
public void testAttributeBuilder() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(); AttributeTypeBuilder builder = new AttributeTypeBuilder(); builder.binding(Integer.class); builder.minOccurs(1).maxOccurs(1); builder.defaultValue(0); builder.name("percent").description("Percent between 0 and 100"); builder.restriction(ff.greaterOrEqual(ff.property("."), ff.literal(0))) .restriction(ff.lessOrEqual(ff.property("."), ff.literal(100))); final AttributeType PERCENT = builder.buildType(); builder.minOccurs(1).maxOccurs(1); builder.defaultValue(0); builder.name("percent").description("Percent between 0 and 100"); AttributeDescriptor a = builder.buildDescriptor("a", PERCENT); assertSame(a.getType(), PERCENT); assertEquals(a.getDefaultValue(), 0); Filter restrictions = ff.and(PERCENT.getRestrictions()); assertTrue(restrictions.evaluate(50)); assertFalse(restrictions.evaluate(150)); }