本文整理了Java中org.opengis.filter.FilterFactory2.isNull()
方法的一些代码示例,展示了FilterFactory2.isNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.isNull()
方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:isNull
暂无
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsNull filter, Object arg1) {
Expression nullCheck = filter.getExpression();
List sourceChecks = (List) nullCheck.accept(this, null);
List combined = new ArrayList(sourceChecks.size());
for (Iterator it = sourceChecks.iterator(); it.hasNext(); ) {
Expression sourceValue = (Expression) it.next();
Filter newFilter = ff.isNull(sourceValue);
combined.add(newFilter);
}
Filter unrolled = combineOred(combined);
return unrolled;
}
代码示例来源:origin: geotools/geotools
/**
* Parses a null filter from a node known to be a null node.
*
* @param nullNode the PropertyIsNull node.
* @return a null filter of the expression contained in null node.
* @throws IllegalFilterException DOCUMENT ME!
*/
private static PropertyIsNull parseNullFilter(Node nullNode) throws IllegalFilterException {
final ExpressionDOMParser expressionDOMParser = new ExpressionDOMParser(FILTER_FACT);
LOGGER.finest("parsing null node: " + nullNode);
Node value = nullNode.getFirstChild();
while (value.getNodeType() != Node.ELEMENT_NODE) {
value = value.getNextSibling();
}
LOGGER.finest("add null value -> " + value + "<-");
Expression expr = expressionDOMParser.expression(value);
return FILTER_FACT.isNull(expr);
}
}
代码示例来源:origin: geotools/geotools
/**
* @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element,
* org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map)
*/
public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
throws SAXException {
FilterFactory2 factory = FilterSchema.filterFactory(hints);
try {
Expression expr = (Expression) value[0].getValue();
return factory.isNull(expr);
} catch (ClassCastException expressionRequired) {
throw new SAXException("Illegal filter for " + element, expressionRequired);
} catch (IllegalFilterException e) {
throw new SAXException("Illegal filter for " + element);
}
}
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsNull filter, Object extraData) {
Expression expr = visit(filter.getExpression(), extraData);
return getFactory(extraData).isNull(expr);
}
代码示例来源:origin: geotools/geotools
static PropertyIsNull propertyIsNull() {
return f.isNull(propertyName());
}
代码示例来源:origin: geotools/geotools
/**
* Test the null operator.
*
* @throws IllegalFilterException If the constructed filter is not valid.
*/
public void testNull() throws IllegalFilterException {
PropertyIsNull filter = fac.isNull(fac.property("foo"));
assertAttributeName(filter, new String[] {"foo"});
}
代码示例来源:origin: geotools/geotools
/**
* Guards the filter against potential null values in the target property name (if it is a
* property name, to start with)
*/
private Filter guardAgainstNulls(Filter filter, Expression potentialPropertyName) {
if (potentialPropertyName instanceof PropertyName) {
PropertyName pn = (PropertyName) potentialPropertyName;
String name = pn.getPropertyName();
if (isNillable(name)) {
Not notNull = ff.not(ff.isNull(ff.property(name)));
if (filter instanceof And) {
And and = (And) filter;
List<Filter> children = new ArrayList<Filter>(and.getChildren());
children.add(notNull);
return ff.and(children);
} else {
return ff.and(filter, notNull);
}
}
}
return filter;
}
代码示例来源:origin: geotools/geotools
private Not propertyNotNull(String name) {
return ff.not(ff.isNull(ff.property(name)));
}
}
代码示例来源:origin: geotools/geotools
public void testIdCollector() {
Filter filter = ff.isNull(ff.property("name"));
Set fids = (Set) filter.accept(IdCollectorFilterVisitor.ID_COLLECTOR, new HashSet());
assertTrue(fids.isEmpty());
assertFalse(fids.contains("eclesia"));
filter = ff.id(Collections.singleton(ff.featureId("eclesia")));
fids = (Set) filter.accept(IdCollectorFilterVisitor.ID_COLLECTOR, new HashSet());
assertFalse(fids.isEmpty());
assertTrue(fids.contains("eclesia"));
}
}
代码示例来源:origin: geotools/geotools
/**
* Test the null operator.
*
* @throws IllegalFilterException If the constructed filter is not valid.
*/
public void testNull() throws IllegalFilterException {
// Test for false positive.
PropertyName testAttribute = new AttributeExpressionImpl(testSchema, "testString");
PropertyIsNull filter = fac.isNull(org.opengis.filter.expression.Expression.NIL);
assertTrue(filter.evaluate(testFeature));
filter = fac.isNull(testAttribute);
assertFalse(filter.evaluate(testFeature));
}
代码示例来源:origin: geotools/geotools
@Test
public void testNull() {
Filter filter = ff.isNull(ff.property("name"));
Envelope env = (Envelope) filter.accept(visitor, null);
assertEquals(infinity, env);
}
代码示例来源:origin: geotools/geotools
public void testNullFilterVisitor() {
Filter filter = ff.isNull(ff.property("name"));
assertEquals(Integer.valueOf(1), filter.accept(NullFilterVisitor.NULL_VISITOR, 1));
filter = Filter.INCLUDE;
assertEquals(Integer.valueOf(1), filter.accept(NullFilterVisitor.NULL_VISITOR, 1));
FilterVisitor allFids =
new NullFilterVisitor() {
public Object visit(Id filter, Object data) {
if (data == null) return null;
Set set = (Set) data;
set.addAll(filter.getIDs());
return set;
}
};
Filter myFilter = ff.id(Collections.singleton(ff.featureId("fred")));
Set set = (Set) myFilter.accept(allFids, new HashSet());
assertNotNull(set);
Set set2 = (Set) myFilter.accept(allFids, null); // set2 will be null
assertNull(set2);
}
代码示例来源:origin: geotools/geotools
public void testIdFinderFilterVisitor() {
Filter filter = ff.isNull(ff.property("name"));
boolean found = (Boolean) filter.accept(new IdFinderFilterVisitor(), null);
assertFalse(found);
filter = ff.id(Collections.singleton(ff.featureId("eclesia")));
found = (Boolean) filter.accept(new IdFinderFilterVisitor(), null);
assertTrue(found);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndIsNull() throws Exception {
final Filter f =
ff.and(ff.bbox("geom", -10, -10, 10, 10, null), ff.isNull(ff.literal("someDate")));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testNullFilter() throws Exception {
PropertyIsNull nullFilter = ff.isNull(ff.property("measurement/result"));
Filter unrolled = (Filter) nullFilter.accept(visitor, null);
assertTrue(unrolled instanceof PropertyIsNull);
assertNotSame(nullFilter, unrolled);
PropertyIsNull unmapped = (PropertyIsNull) unrolled;
Expression unmappedAtt = unmapped.getExpression();
assertTrue(unmappedAtt instanceof PropertyName);
assertEquals("results_value", ((PropertyName) unmappedAtt).getPropertyName());
}
代码示例来源:origin: org.geotools/gt-app-schema
public Object visit(PropertyIsNull filter, Object arg1) {
Expression nullCheck = filter.getExpression();
List sourceChecks = (List) nullCheck.accept(this, null);
List combined = new ArrayList(sourceChecks.size());
for (Iterator it = sourceChecks.iterator(); it.hasNext();) {
Expression sourceValue = (Expression) it.next();
Filter newFilter = ff.isNull(sourceValue);
combined.add(newFilter);
}
Filter unrolled = combineOred(combined);
return unrolled;
}
代码示例来源:origin: geotools/geotools
PropertyIsNull nullFilter = fac.isNull(testAttribute);
代码示例来源:origin: org.geotools/gt-main
public Object visit(PropertyIsNull filter, Object extraData) {
Expression expr= visit(filter.getExpression(), extraData);
return getFactory(extraData).isNull(expr);
}
代码示例来源:origin: org.geotools/gt2-main
public Object visit(PropertyIsNull filter, Object extraData) {
Expression expr=(Expression) filter.getExpression().accept(this, extraData);
return getFactory(extraData).isNull(expr);
}
代码示例来源:origin: org.geotools/gt-app-schema
@Test
public void testNullFilter() throws Exception {
PropertyIsNull nullFilter = ff.isNull(ff.property("measurement/result"));
Filter unrolled = (Filter) nullFilter.accept(visitor, null);
assertTrue(unrolled instanceof PropertyIsNull);
assertNotSame(nullFilter, unrolled);
PropertyIsNull unmapped = (PropertyIsNull) unrolled;
Expression unmappedAtt = unmapped.getExpression();
assertTrue(unmappedAtt instanceof PropertyName);
assertEquals("results_value", ((PropertyName) unmappedAtt).getPropertyName());
}
内容来源于网络,如有侵权,请联系作者删除!