本文整理了Java中org.geotools.filter.Filters.getExpressionType()
方法的一些代码示例,展示了Filters.getExpressionType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filters.getExpressionType()
方法的具体详情如下:
包路径:org.geotools.filter.Filters
类名称:Filters
方法名:getExpressionType
[英]Convert expression to a constant for use in switch statements. This is an alternative to performing instanceof checks. p> This utility method for those upgrading to a newer version of GeoTools, instance of checks are preferred as they will take into account new kinds of expressions as the filter specification grows over time. Example:
BEFORE: expression.getType() == ExpressionType.MATH_ADD
QUICK: Filters.getExpressionType( expression ) == ExpressionType.MATH_ADD
AFTER: expression instanceof Add
[中]将表达式转换为常量,以便在switch语句中使用。这是执行instanceof检查的替代方法。p> 对于升级到较新版本的GeoTools的用户来说,这种实用方法是首选的,因为随着过滤器规范的不断增长,它们将考虑新的表达式类型。示例:
BEFORE: expression.getType() == ExpressionType.MATH_ADD
QUICK: Filters.getExpressionType( expression ) == ExpressionType.MATH_ADD
AFTER: expression instanceof Add
代码示例来源:origin: geotools/geotools
/**
* Override of hashCode method.
*
* @return the hash code for this literal expression
*/
public int hashCode() {
int result = 17;
result = (37 * result) + ((literal == null) ? 0 : literal.hashCode());
result = (37 * result) + Filters.getExpressionType(this);
return result;
}
代码示例来源:origin: geotools/geotools
(Filters.getExpressionType(expAttr) == Filters.getExpressionType(this));
if (LOGGER.isLoggable(Level.FINEST))
LOGGER.finest(
+ isEqual
+ "; in:"
+ Filters.getExpressionType(expAttr)
+ "; out:"
+ Filters.getExpressionType(this));
isEqual =
(expAttr.attPath != null)
代码示例来源:origin: geotools/geotools
/**
* 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;
}
代码示例来源:origin: geotools/geotools
/**
* 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;
}
代码示例来源:origin: geotools/geotools
public void testGetType() {
assertEquals(ExpressionType.FUNCTION, Filters.getExpressionType(function));
}
代码示例来源:origin: geotools/geotools
if (getExpressionType(this) == getExpressionType(expLit)) {
if (this.literal.equals(expLit.literal)) {
return true;
int expressionType = getExpressionType(this);
if (expressionType == ExpressionType.LITERAL_GEOMETRY) {
return ((Geometry) this.literal).equalsExact(expLit.evaluate(null, Geometry.class));
代码示例来源:origin: geotools/geotools
if (ExpressionType.FUNCTION != Filters.getExpressionType(function)) {
errors.add(functionClass + ".getType != " + ExpressionType.FUNCTION);
代码示例来源:origin: geotools/geotools
String uri = getNamespace().toString();
if (Filters.getExpressionType(distanceFilter.getExpression1())
== ExpressionType.LITERAL_GEOMETRY) {
Geometry geometry = distanceFilter.getExpression1().evaluate(null, Geometry.class);
代码示例来源:origin: geotools/geotools
int i = 0;
switch (Filters.getExpressionType(expr)) {
代码示例来源:origin: geotools/geotools
public void testLiteralExpression() {
LiteralExpressionImpl literal;
literal = new LiteralExpressionImpl(1.0D);
assertEquals(ExpressionType.LITERAL_DOUBLE, Filters.getExpressionType(literal));
assertEquals(new Double(1.0D), literal.evaluate((Feature) null));
GeometryFactory gf = new GeometryFactory();
literal = new LiteralExpressionImpl(gf.createPoint(new Coordinate(0, 0)));
assertEquals(ExpressionType.LITERAL_GEOMETRY, Filters.getExpressionType(literal));
Geometry value = (Geometry) literal.evaluate((Feature) null);
assertTrue(gf.createPoint(new Coordinate(0, 0)).equalsExact(value));
literal = new LiteralExpressionImpl(1);
assertEquals(ExpressionType.LITERAL_INTEGER, Filters.getExpressionType(literal));
assertEquals(Integer.valueOf(1), literal.evaluate((Feature) null));
literal = new LiteralExpressionImpl(1L);
assertEquals(ExpressionType.LITERAL_LONG, Filters.getExpressionType(literal));
assertEquals(Long.valueOf(1), literal.evaluate((Feature) null));
literal = new LiteralExpressionImpl("string value");
assertEquals(ExpressionType.LITERAL_STRING, Filters.getExpressionType(literal));
assertEquals("string value", literal.evaluate((Feature) null));
literal = new LiteralExpressionImpl(new Date(0));
assertEquals(ExpressionType.LITERAL_UNDECLARED, Filters.getExpressionType(literal));
assertEquals(new Date(0), literal.evaluate((Feature) null));
literal = new LiteralExpressionImpl(null);
assertEquals(ExpressionType.LITERAL_UNDECLARED, Filters.getExpressionType(literal));
assertNull(literal.evaluate((Feature) null));
}
代码示例来源:origin: geotools/geotools
output.startElement(element.getNamespace(), element.getName(), ai);
switch (Filters.getExpressionType(me)) {
case org.geotools.filter.ExpressionType.LITERAL_GEOMETRY:
if (me.getValue() instanceof Geometry) {
代码示例来源:origin: geotools/geotools
short TYPE1 = Filters.getExpressionType(lf.getExpression1());
short TYPE2 = Filters.getExpressionType(lf.getExpression2());
if (TYPE1 == org.geotools.filter.ExpressionType.LITERAL_GEOMETRY) {
elems[0].getType()
代码示例来源:origin: org.geomajas.plugin/geomajas-layer-hibernate
public void setExpression(org.opengis.filter.expression.Expression e) {
if (!(e instanceof Expression)) {
throw new IllegalArgumentException("Expression " + e + " should be an Expression.");
}
Expression exprAttribute = (Expression) e;
if ((Filters.getExpressionType(exprAttribute) != ExpressionType.ATTRIBUTE_STRING)) {
this.attribute = exprAttribute;
} else {
throw new IllegalFilterException("Attempted to add something other than a string attribute "
+ "expression to a like filter.");
}
}
代码示例来源:origin: geotools/geotools
if (Filters.getExpressionType(lf.getExpression1())
== org.geotools.filter.ExpressionType.ATTRIBUTE) {
elems[0].getType()
if (Filters.getExpressionType(lf.getExpression2())
== org.geotools.filter.ExpressionType.ATTRIBUTE) {
elems[0].getType()
代码示例来源:origin: geotools/geotools
short type1 = Filters.getExpressionType(lf.getExpression1());
short type2 = Filters.getExpressionType(lf.getExpression2());
if ((type1 == org.geotools.filter.ExpressionType.LITERAL_STRING)
|| (type1 == org.geotools.filter.ExpressionType.ATTRIBUTE_STRING)
代码示例来源:origin: geotools/geotools
Expression e = (Expression) value;
switch (Filters.getExpressionType(e)) {
case ATTRIBUTE:
case ATTRIBUTE_DOUBLE:
内容来源于网络,如有侵权,请联系作者删除!