@Override public Expression getExpression2(BinaryComparisonOperator filter) { return filter.getExpression2(); }
@Override protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter) { Expression expression1 = filter.getExpression1(); Expression expression2 = filter.getExpression2(); if ((expression1 instanceof JsonSelectFunction || expression1 instanceof JsonSelectAllFunction) && expression2 instanceof Literal) { preStack.push(filter); } else if ((expression2 instanceof JsonSelectFunction || expression2 instanceof JsonSelectAllFunction) && expression1 instanceof Literal) { preStack.push(filter); } }
public Object getProperty(Object object, QName name) throws Exception { if (OGC.expression.equals(name)) { BinaryComparisonOperator op = (BinaryComparisonOperator) object; return new Expression[] {op.getExpression1(), op.getExpression2()}; } // filter 1.1 only if ("matchCase".equals(name.getLocalPart())) { BinaryComparisonOperator op = (BinaryComparisonOperator) object; return Boolean.valueOf(op.isMatchingCase()); } return null; } }
@Override public Object getProperty(Object object, QName name) throws Exception { BinaryComparisonOperator op = (BinaryComparisonOperator) object; if ("matchAction".equals(name.getLocalPart())) { return op.getMatchAction().name(); } if ("matchCase".equals(name.getLocalPart())) { return op.isMatchingCase(); } if (FES.expression.equals(name)) { return new Expression[] {op.getExpression1(), op.getExpression2()}; } return null; } }
/** * Visits filter.getExpression1(), and filter.getExpression2() if an expression visitor was set. */ protected Object visit(BinaryComparisonOperator filter, Object data) { if (expressionVisitor != null) { if (filter.getExpression1() != null) { filter.getExpression1().accept(expressionVisitor, data); } if (filter.getExpression2() != null) { filter.getExpression2().accept(expressionVisitor, data); } } return filter; }
private void visitBinaryComparisonOperator(BinaryComparisonOperator filter) { visitBinaryOperator(filter, filter.getExpression1(), filter.getExpression2()); }
Expression rightValue = filter.getExpression2(); if (leftValue == null || rightValue == null) { postStack.push(filter);
/** * Returns a CompareFilter of the same type than <code>filter</code>, but built on the unmapped * expressions pointing to the surrogate type attributes. * * @return the scalar product of the evaluation of both expressions */ public Expression[][] visitBinaryComparisonOperator(BinaryComparisonOperator filter) { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); List leftExpressions = (List) left.accept(this, null); List rightExpressions = (List) right.accept(this, null); if (leftExpressions.size() == 0) { throw new IllegalStateException(left + " mapping not found"); } if (rightExpressions.size() == 0) { throw new IllegalStateException(right + " mapping not found"); } Expression[][] product = buildExpressionsMatrix(leftExpressions, rightExpressions); return product; }
|| filter1 instanceof PropertyIsLessThan) { min1 = ((BinaryComparisonOperator) filter1).getExpression1(); max1 = ((BinaryComparisonOperator) filter1).getExpression2(); } else if (filter1 instanceof PropertyIsGreaterThanOrEqualTo || filter1 instanceof PropertyIsGreaterThan) { min1 = ((BinaryComparisonOperator) filter1).getExpression2(); max1 = ((BinaryComparisonOperator) filter1).getExpression1(); } else { || filter2 instanceof PropertyIsLessThan) { min2 = ((BinaryComparisonOperator) filter2).getExpression1(); max2 = ((BinaryComparisonOperator) filter2).getExpression2(); } else if (filter2 instanceof PropertyIsGreaterThanOrEqualTo || filter2 instanceof PropertyIsGreaterThan) { min2 = ((BinaryComparisonOperator) filter2).getExpression2(); max2 = ((BinaryComparisonOperator) filter2).getExpression1(); } else {
private Object guardAgainstNulls(BinaryComparisonOperator clone) { Filter result = guardAgainstNulls(clone, clone.getExpression1()); result = guardAgainstNulls(result, clone.getExpression2()); return result; }
length = Integer.parseInt( ((Literal) cf.getExpression2()).getValue().toString()); } else { if (cf.getExpression2() instanceof LengthFunction) { length = Integer.parseInt(
/** * Builds a comparison predicate inserting the operato1 or operator2 taking into account the * PropertyName position in the comparison filter. * * @param filter * @param extraData * @param operator an operator * @return SringBuffer */ public static Object buildComparison( BinaryComparisonOperator filter, Object extraData, String operator) { StringBuilder output = asStringBuilder(extraData); ExpressionToText visitor = new ExpressionToText(); Expression expr = filter.getExpression1(); expr.accept(visitor, output); output.append(" ").append(operator).append(" "); filter.getExpression2().accept(visitor, output); return output; }
private Object simplifyBinaryComparisonOperator(BinaryComparisonOperator clone) { if (isConstant(clone.getExpression1()) && isConstant(clone.getExpression2())) { return staticFilterEvaluate(clone); } else { return clone; } }
BasicDBObject encodeBinaryComparisonOp( BinaryComparisonOperator filter, String op, Object extraData) { BasicDBObject output = asDBObject(extraData); Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); Class<?> leftValueType = getValueType(right), rightValueType = getValueType(left); Object leftValue = filter.getExpression1().accept(this, leftValueType); Object rightValue = filter.getExpression2().accept(this, rightValueType); if (rightValue instanceof String && !(leftValue instanceof String)) { // reverse Object tmp = leftValue; leftValue = rightValue; rightValue = tmp; } output.put((String) leftValue, op == null ? rightValue : new BasicDBObject(op, rightValue)); return output; }
Object transform(BinaryComparisonOperator filter, Object extraData) { // binary filters may use two random expressions, check if we have // enough information for a reprojection PropertyName name; Expression other; if ((filter.getExpression1() instanceof PropertyName)) { name = (PropertyName) filter.getExpression1(); other = filter.getExpression2(); } else if (filter.getExpression2() instanceof PropertyName) { name = (PropertyName) filter.getExpression2(); other = filter.getExpression1(); } else { return cloneFilter(filter, extraData); } CoordinateReferenceSystem propertyCrs = findPropertyCRS(name); // we have to reproject only if the property is geometric if (propertyCrs == null) return cloneFilter(filter, extraData); // "transformed" expressions Expression ex1 = (Expression) name.accept(ReprojectingFilterVisitor.this, extraData); Expression ex2 = reproject(other, propertyCrs, false); if (ex2 == null) ex2 = (Expression) other.accept(ReprojectingFilterVisitor.this, extraData); return cloneFilter(filter, extraData, ex1, ex2); }
BinaryComparisonOperator cf = (BinaryComparisonOperator) f; if (cf.getExpression1() instanceof LengthFunction) { filterLength = cf.getExpression2().evaluate(null, Integer.class) - 1; filterLength = cf.getExpression2().evaluate(null, Integer.class); if (cf.getExpression2() instanceof LengthFunction) { filterLength = cf.getExpression1().evaluate(null, Integer.class) - 1; if (cf.getExpression2() instanceof LengthFunction) { filterLength = cf.getExpression1().evaluate(null, Integer.class);
/** * Overrides base behavior to handler arrays * * @param filter the comparison to be turned into SQL. * @param extraData * @throws RuntimeException */ protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData) throws RuntimeException { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); Class rightContext = super.getExpressionType(left); Class leftContext = super.getExpressionType(right); // array comparison in PostgreSQL is strict, need to know the base type, that info is // available only in the property name userdata String type = (String) extraData; if ((helper.isArray(rightContext) || helper.isArray(leftContext)) && (left instanceof PropertyName || right instanceof PropertyName)) { helper.out = out; helper.visitArrayComparison(filter, left, right, rightContext, leftContext, type); } else { super.visitBinaryComparisonOperator(filter, extraData); } }
/** * Overrides base behavior to handler arrays * * @param filter the comparison to be turned into SQL. * @param extraData * @throws RuntimeException */ protected void visitBinaryComparisonOperator(BinaryComparisonOperator filter, Object extraData) throws RuntimeException { Expression left = filter.getExpression1(); Expression right = filter.getExpression2(); Class rightContext = super.getExpressionType(left); Class leftContext = super.getExpressionType(right); // array comparison in PostgreSQL is strict, need to know the base type, that info is // available only in the property name userdata String type = (String) extraData; if ((helper.isArray(rightContext) || helper.isArray(leftContext)) && (left instanceof PropertyName || right instanceof PropertyName)) { helper.out = out; helper.visitArrayComparison(filter, left, right, rightContext, leftContext, type); } else { super.visitBinaryComparisonOperator(filter, extraData); } }
Class binding = getTypeIfComparable(expression); if (binding != null) { Object value = evaluate(op.getExpression2(), binding); if (value != null) { if (op instanceof PropertyIsLessThan) { } else if (!isStatic(op.getExpression2())) { expression = op.getExpression2(); Class binding = getTypeIfComparable(expression); if (binding != null) {
/** * @see org.geotools.xml.schema.Type#encode(org.geotools.xml.schema.Element, * java.lang.Object, org.geotools.xml.PrintHandler, java.util.Map) */ public void encode(Element element, Object value, PrintHandler output, Map hints) throws IOException, OperationNotSupportedException { if (!canEncode(element, value, hints)) { return; } BinaryComparisonOperator cf = (BinaryComparisonOperator) value; output.startElement(element.getNamespace(), element.getName(), null); // TODO is this order dependant? encodeExpr(cf.getExpression1(), output, hints); encodeExpr(cf.getExpression2(), output, hints); output.endElement(element.getNamespace(), element.getName()); } }