/** * Gets the left or first expression. * * @throws IllegalFilterException */ public void setExpression1(org.opengis.filter.expression.Expression expression) { if (isGeometryExpression(Filters.getExpressionType(expression))) { throw new IllegalFilterException( "Attempted to add Geometry expression to math expression."); } this.leftValue = expression; }
public PropertyName property(String name, NamespaceSupport namespaceContext) { if (namespaceContext == null) { return property(name); } return new AttributeExpressionImpl(name, namespaceContext); }
private void addFilterToParent() throws IllegalFilterException { parent.filter(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
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 SortBy sort(String propertyName, SortOrder order) { return new SortByImpl(property(propertyName), order); }
public void testNullFilter() throws IllegalFilterException { testExp1 = new AttributeExpressionImpl(testSchema, "testDouble"); testExp2 = new AttributeExpressionImpl(testSchema, "testDouble"); testExp3 = new AttributeExpressionImpl(testSchema, "testBoolean"); NullFilterImpl nullFilter1 = new NullFilterImpl(); NullFilterImpl nullFilter2 = new NullFilterImpl(); nullFilter1.setExpression(testExp1); nullFilter2.setExpression(testExp2); assertTrue(nullFilter1.equals(nullFilter2)); nullFilter1.setExpression(testExp3); assertTrue(!nullFilter1.equals(nullFilter2)); assertTrue(!nullFilter1.equals(new BetweenFilterImpl())); }
public void testGetArgs() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); function.setParameters(expected); List<Expression> actual = function.getParameters(); assertEquals(expected, actual); }
public void testToString() throws Exception { FunctionImpl func = new FunctionImpl(); Expression param = new LiteralExpressionImpl(42); func.setName("TestFunction"); func.setParameters(Collections.singletonList(param)); String result = func.toString(); assertEquals("TestFunction([42])", result); }
public void testSetArgs() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); function.setParameters(expected); assertEquals(expected, function.params); }
public PropertyIsLike like( Expression expr, String pattern, String wildcard, String singleChar, String escape, boolean matchCase) { LikeFilterImpl filter = new LikeFilterImpl(); filter.setExpression(expr); filter.setPattern(pattern, wildcard, singleChar, escape); filter.setMatchingCase(matchCase); return filter; }
public void testShortSupports() { assertTrue(capabilities.supports(AbstractFilter.LOGIC_AND)); assertTrue(!(capabilities.supports(AbstractFilter.LIKE))); }
public void testGetParameters() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); // do not try this at home function.params = expected; assertEquals(expected, function.getParameters()); }
private void addFilterToLogicFactory() throws IllegalFilterException { logicFactory.add(filterFactory.create()); expressionFactory = new ExpressionSAXParser(schema); }
public void testFidFilter() { FidFilterImpl ff = new FidFilterImpl(); ff.addFid("1"); FidFilterImpl ff2 = new FidFilterImpl("1"); assertNotNull(ff2); assertEquals(ff, ff2); assertTrue(!ff.equals(null)); assertTrue(!ff.equals("a string not even a filter")); ff2.addFid("2"); assertTrue(!ff.equals(ff2)); ff.addFid("2"); assertEquals(ff, ff2); }
List<FunctionName> functionNames = factory.getFunctionNames(); Function f = factory.function(IsInstanceOf.NAME.getFunctionName(), args, null); assertNotNull(f); f = factory.function(IsInstanceOf.NAME.getName(), args, null); assertNotNull(f); f = factory.function(IsInstanceOf.NAME.getName(), args, null); } catch (IllegalArgumentException e) { catchedException = true; try { f = factory.function(IsInstanceOf.NAME.getName(), null, null); } catch (NullPointerException e) { catchedException = true;
public void testGetName() { FunctionExpressionImpl anonymous = new FunctionExpressionImpl( FunctionExpressionImpl.functionName("testFunction", "text:String")) {}; assertEquals("testFunction", anonymous.getName()); }
public void testGetType() { assertEquals(ExpressionType.FUNCTION, Filters.getExpressionType(function)); }
public void testSetParameters() { final List expected = Collections.singletonList(new LiteralExpressionImpl(10d)); // do not try this at home function.setParameters(expected); assertEquals(expected, function.params); }
/** * Gets the second expression. * * @throws IllegalFilterException */ public void setExpression2(org.opengis.filter.expression.Expression expression) { // Check to see if this is a valid math expression before adding. if (isGeometryExpression(Filters.getExpressionType(expression))) { throw new IllegalFilterException( "Attempted to add Geometry expression to math expression."); } this.rightValue = expression; }
public void testFilterSupports() { assertTrue(capabilities.supports(compFilter)); assertTrue(!(capabilities.supports(gFilter))); }