/** * Get a hours expression (range 0-23) * * @return */ public NumberExpression<Integer> hour() { if (hours == null) { hours = NumberOperation.create(Integer.class, Ops.DateTimeOps.HOUR, mixin); } return hours; }
public static <D extends Number & Comparable<?>> NumberExpression<D> create(Class<? extends D> type, Operator<? super D> op, Expression<?> one) { return new NumberOperation<D>(type, op, ImmutableList.<Expression<?>>of(one)); }
/** * Get a year / month expression * * @return */ public NumberExpression<Integer> yearMonth() { if (yearMonth == null) { yearMonth = NumberOperation.create(Integer.class, Ops.DateTimeOps.YEAR_MONTH, mixin); } return yearMonth; }
/** * @param num * @return rad(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> radians(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.RAD, num); }
/** * Get a minutes expression (range 0-59) * * @return */ public NumberExpression<Integer> minute() { if (minutes == null) { minutes = NumberOperation.create(Integer.class, Ops.DateTimeOps.MINUTE, mixin); } return minutes; }
/** * Get a year expression * * @return */ public NumberExpression<Integer> year() { if (year == null) { year = NumberOperation.create(Integer.class, Ops.DateTimeOps.YEAR, mixin); } return year; }
/** * Get the square root of this numeric expressions * * @return sqrt(this) */ public NumberExpression<Double> sqrt() { if (sqrt == null) { sqrt = NumberOperation.create(Double.class, MathOps.SQRT, mixin); } return sqrt; }
/** * Create a new Operation expression * * @param type * @param operator * @param args * @return */ public static <T extends Number & Comparable<?>> NumberExpression<T> numberOperation(Class<T> type, Operator<? super T> operator, Expression<?>... args) { return NumberOperation.create(type, operator, args); }
/** * Get a minutes expression (range 0-59) * * @return */ public NumberExpression<Integer> minute() { if (minutes == null) { minutes = NumberOperation.create(Integer.class, Ops.DateTimeOps.MINUTE, mixin); } return minutes; }
/** * @param num * @return acos(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> acos(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.ACOS, num); }
/** * @param num * @return cos(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> cos(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.COS, num); }
/** * @param num * @return cosh(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> cosh(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.COSH, num); }
/** * @param num * @return cot(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> cot(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.COT, num); }
/** * @param num * @return exp(num) */ public static <A extends Number & Comparable<?>> NumberExpression<Double> exp(Expression<A> num) { return NumberOperation.create(Double.class, Ops.MathOps.EXP, num); }
/** * Return the length of this String * * @return this.length() * @see java.lang.String#length() */ public NumberExpression<Integer> length() { if (length == null) { length = NumberOperation.create(Integer.class, Ops.STRING_LENGTH, mixin); } return length; }
/** * Get the position of the given String in this String, the first position is 1 * * @param str * @return locate(str, this) */ public NumberExpression<Integer> locate(Expression<String> str) { return NumberOperation.create(Integer.class, Ops.StringOps.LOCATE, str, mixin); }
/** * Get the position of the given String in this String, the first position is 1 * * @param str * @return locate(str, this, start) */ public NumberExpression<Integer> locate(Expression<String> str, NumberExpression<Integer> start) { return NumberOperation.create(Integer.class, Ops.StringOps.LOCATE2, str, mixin, start); }
@SuppressWarnings("unchecked") @Override protected NumberExpression<T> createResult(Class<T> type, Expression<T> last) { return NumberOperation.create(type, Ops.CASE_EQ, base, last); }
/** * Get the average value of this expression (aggregation) * * @return avg(this) */ public NumberExpression<Double> avg() { if (avg == null) { avg = NumberOperation.create(Double.class, Ops.AggOps.AVG_AGG, mixin); } return avg; }
/** * Get a day of month expression (range 1-31) * * @return */ public NumberExpression<Integer> dayOfMonth() { if (dayOfMonth == null) { dayOfMonth = NumberOperation.create(Integer.class, Ops.DateTimeOps.DAY_OF_MONTH, mixin); } return dayOfMonth; }