/** * Returns a geometric object that represents the Point * set difference of this geometric object with anotherGeometry. * * @param geometry other geometry * @return difference between this and the other geometry */ public JTSGeometryExpression<Geometry> difference(Geometry geometry) { return difference(ConstantImpl.create(geometry)); }
/** * Create an expression out of the given order specifiers * * @param args order * @return expression for order */ public static Expression<?> orderBy(List<OrderSpecifier<?>> args) { return operation(Object.class, Ops.ORDER, ConstantImpl.create(args)); }
/** * Create a {@code this.indexOf(str)} expression * * <p>Get the index of the given substring in this String</p> * * @param str string * @return this.indexOf(str) * @see java.lang.String#indexOf(String) */ public NumberExpression<Integer> indexOf(String str) { return indexOf(ConstantImpl.create(str)); }
/** * Create a {@code this like str} expression ignoring case * * @param str string * @param escape escape character * @return this like string */ public BooleanExpression likeIgnoreCase(Expression<String> str, char escape) { return Expressions.booleanOperation(Ops.LIKE_ESCAPE_IC, mixin, str, ConstantImpl.create(escape)); }
/** * Create a {@code locate(str, this)} expression * * <p>Get the position of the given String in this String, the first position is 1</p> * * @param str string * @return locate(str, this) */ public NumberExpression<Integer> locate(String str) { return Expressions.numberOperation(Integer.class, Ops.StringOps.LOCATE, ConstantImpl.create(str), mixin); }
/** * Create a {@code concat(str, this)} expression * * <p>Prepend the given String and return the result</p> * * @param str string * @return str + this */ public StringExpression prepend(String str) { return prepend(ConstantImpl.create(str)); }
/** * Create a {@code this.startsWithIgnoreCase(str)} expression * * @param str string * @return this.startsWithIgnoreCase(str) */ public BooleanExpression startsWithIgnoreCase(String str) { return startsWithIgnoreCase(ConstantImpl.create(str)); }
/** * Create a case expression builder * * @param other * @return case expression builder */ public CaseForEqBuilder<T> when(T other) { return new CaseForEqBuilder<T>(mixin, ConstantImpl.create(other)); }
/** * Returns 1 (TRUE) if this geometric object “spatially intersects” anotherGeometry. * * @param geometry other geometry * @return true, if intersects */ public BooleanExpression intersects(Geometry geometry) { return intersects(ConstantImpl.create(geometry)); }
/** * Returns 1 (TRUE) if this geometric object “spatially touches” anotherGeometry. * * @param geometry other geometry * @return true, if touches */ public BooleanExpression touches(Geometry geometry) { return touches(ConstantImpl.create(geometry)); }
/** * Returns 1 (TRUE) if this geometric object “spatially crosses’ anotherGeometry. * * @param geometry other geometry * @return trye, if crosses */ public BooleanExpression crosses(Geometry geometry) { return crosses(ConstantImpl.create(geometry)); }
/** * Create a {@code lpad(in, length)} expression * * <p>Returns in left-padded to length characters</p> * * @param in string to be padded * @param length target length * @return lpad(in, length) */ public static StringExpression lpad(Expression<String> in, int length) { return Expressions.stringOperation(Ops.StringOps.LPAD, in, ConstantImpl.create(length)); }
/** * Create a {@code rpad(in, length)} expression * * <p>Returns in right-padded to length characters</p> * * @param in string to be padded * @param length target length * @return rpad(in, length) */ public static StringExpression rpad(Expression<String> in, int length) { return Expressions.stringOperation(Ops.StringOps.RPAD, in, ConstantImpl.create(length)); }
/** * Create a {@code this like str} expression * * @param str rhs * @return this like str */ public BooleanExpression like(String str) { return Expressions.booleanOperation(Ops.LIKE, stringValue(), ConstantImpl.create(str)); }
/** * Create a {@code this <= right} expression * * @param <A> * @param right rhs of the comparison * @return {@code this <= right} * @see java.lang.Comparable#compareTo(Object) */ public final <A extends Number & Comparable<?>> BooleanExpression loe(A right) { return loe(ConstantImpl.create(cast(right))); }
@Override public Object apply(Object arg) { if (arg instanceof Constant<?>) { return ConstantImpl.create(apply(arg.toString()).toString()); } else if (arg instanceof Expression) { Expression<String> concatenated = ExpressionUtils.operation(String.class, Ops.CONCAT, (Expression) arg, PERCENT); return ExpressionUtils.operation(String.class, Ops.LOWER, concatenated); } else { return escapeForLike(String.valueOf(arg).toLowerCase()) + "%"; } } };
/** * Sets the SRID on a geometry to a particular integer value. * * @param expr geometry * @param srid SRID * @param <T> * @return geometry */ public static <T extends Geometry> JTSGeometryExpression<T> setSRID(Expression<T> expr, int srid) { return geometryOperation(expr.getType(), SpatialOps.SET_SRID, expr, ConstantImpl.create(srid)); }
@SuppressWarnings("unchecked") public Q otherwise(A constant) { if (constant != null) { return otherwise(ConstantImpl.create(constant)); } else { return otherwise((Q) NullExpression.DEFAULT); } }
@SuppressWarnings("unchecked") public DateConstant(D date) { super(ConstantImpl.create(date)); this.date = (D) date.clone(); this.calendar = Calendar.getInstance(); calendar.setTime(date); }