Search in sources :

Example 1 with NumericExpression

use of javax.jdo.query.NumericExpression in project datanucleus-api-jdo by datanucleus.

the class ComparableExpressionImpl method max.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#max()
     */
public NumericExpression max() {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(queryExpr);
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(null, "max", args);
    return new NumericExpressionImpl<T>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) ComparableExpression(javax.jdo.query.ComparableExpression) Expression(org.datanucleus.query.expression.Expression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) OrderExpression(javax.jdo.query.OrderExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(org.datanucleus.query.expression.Expression) ArrayList(java.util.ArrayList)

Example 2 with NumericExpression

use of javax.jdo.query.NumericExpression in project datanucleus-api-jdo by datanucleus.

the class ComparableExpressionImpl method min.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#min()
     */
public NumericExpression min() {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(queryExpr);
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(null, "min", args);
    return new NumericExpressionImpl<T>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) ComparableExpression(javax.jdo.query.ComparableExpression) Expression(org.datanucleus.query.expression.Expression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) OrderExpression(javax.jdo.query.OrderExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(org.datanucleus.query.expression.Expression) ArrayList(java.util.ArrayList)

Example 3 with NumericExpression

use of javax.jdo.query.NumericExpression in project datanucleus-api-jdo by datanucleus.

the class StringExpressionImpl method indexOf.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.StringExpression#indexOf(java.lang.String, org.datanucleus.query.typesafe.NumericExpression)
     */
public NumericExpression<Integer> indexOf(String str, NumericExpression pos) {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(new Literal(str));
    args.add(((ExpressionImpl) pos).getQueryExpression());
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "indexOf", args);
    return new NumericExpressionImpl<Integer>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) CharacterExpression(javax.jdo.query.CharacterExpression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) StringExpression(javax.jdo.query.StringExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(javax.jdo.query.Expression) Literal(org.datanucleus.query.expression.Literal) ArrayList(java.util.ArrayList)

Example 4 with NumericExpression

use of javax.jdo.query.NumericExpression in project datanucleus-api-jdo by datanucleus.

the class StringExpressionImpl method indexOf.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.StringExpression#indexOf(org.datanucleus.query.typesafe.StringExpression, int)
     */
public NumericExpression<Integer> indexOf(StringExpression expr, int pos) {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(((ExpressionImpl) expr).getQueryExpression());
    args.add(new Literal(pos));
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(queryExpr, "indexOf", args);
    return new NumericExpressionImpl<Integer>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) NumericExpression(javax.jdo.query.NumericExpression) CharacterExpression(javax.jdo.query.CharacterExpression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) StringExpression(javax.jdo.query.StringExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) Expression(javax.jdo.query.Expression) Literal(org.datanucleus.query.expression.Literal) ArrayList(java.util.ArrayList)

Example 5 with NumericExpression

use of javax.jdo.query.NumericExpression in project datanucleus-api-jdo by datanucleus.

the class ExpressionImpl method countDistinct.

/* (non-Javadoc)
     * @see org.datanucleus.query.typesafe.Expression#countDistinct()
     */
public NumericExpression<Long> countDistinct() {
    List<org.datanucleus.query.expression.Expression> args = new ArrayList();
    args.add(new DyadicExpression(org.datanucleus.query.expression.Expression.OP_DISTINCT, queryExpr));
    org.datanucleus.query.expression.Expression invokeExpr = new InvokeExpression(null, "count", args);
    return new NumericExpressionImpl<Long>(invokeExpr);
}
Also used : InvokeExpression(org.datanucleus.query.expression.InvokeExpression) DyadicExpression(org.datanucleus.query.expression.DyadicExpression) ParameterExpression(org.datanucleus.query.expression.ParameterExpression) InvokeExpression(org.datanucleus.query.expression.InvokeExpression) PersistableExpression(javax.jdo.query.PersistableExpression) BooleanExpression(javax.jdo.query.BooleanExpression) VariableExpression(org.datanucleus.query.expression.VariableExpression) NumericExpression(javax.jdo.query.NumericExpression) PrimaryExpression(org.datanucleus.query.expression.PrimaryExpression) Expression(javax.jdo.query.Expression) ArrayList(java.util.ArrayList) DyadicExpression(org.datanucleus.query.expression.DyadicExpression)

Aggregations

ArrayList (java.util.ArrayList)7 BooleanExpression (javax.jdo.query.BooleanExpression)7 NumericExpression (javax.jdo.query.NumericExpression)7 PersistableExpression (javax.jdo.query.PersistableExpression)7 DyadicExpression (org.datanucleus.query.expression.DyadicExpression)7 InvokeExpression (org.datanucleus.query.expression.InvokeExpression)7 Expression (javax.jdo.query.Expression)5 CharacterExpression (javax.jdo.query.CharacterExpression)4 StringExpression (javax.jdo.query.StringExpression)4 Literal (org.datanucleus.query.expression.Literal)4 ComparableExpression (javax.jdo.query.ComparableExpression)2 OrderExpression (javax.jdo.query.OrderExpression)2 Expression (org.datanucleus.query.expression.Expression)2 ParameterExpression (org.datanucleus.query.expression.ParameterExpression)1 PrimaryExpression (org.datanucleus.query.expression.PrimaryExpression)1 VariableExpression (org.datanucleus.query.expression.VariableExpression)1