/** * PUBLIC: * Return a new expression that applies the function to the given expression. */ public static Expression multiply(Expression left, int right) { return multiply(left, Integer.valueOf(right)); }
/** * PUBLIC: * Return a new expression that applies the function to the given expression. */ public static Expression multiply(Expression left, int right) { return multiply(left, new Integer(right)); }
/** * PUBLIC: * Return a new expression that applies the function to the given expression. */ public static Expression multiply(Expression left, int right) { return multiply(left, Integer.valueOf(right)); }
/** * {@inheritDoc} */ @Override public void visit(MultiplicationExpression expression) { List<Class<?>> types = new ArrayList<Class<?>>(2); // Create the left side of the multiplication expression expression.getLeftExpression().accept(this); Expression leftExpression = queryExpression; types.add(type[0]); // Create the right side of the multiplication expression expression.getRightExpression().accept(this); Expression rightExpression = queryExpression; types.add(type[0]); // Now create the multiplication expression queryExpression = ExpressionMath.multiply(leftExpression, rightExpression); // Set the expression type Collections.sort(types, NumericTypeComparator.instance()); type[0] = types.get(0); }
/** * {@inheritDoc} */ @Override public void visit(MultiplicationExpression expression) { List<Class<?>> types = new ArrayList<Class<?>>(2); // Create the left side of the multiplication expression expression.getLeftExpression().accept(this); Expression leftExpression = queryExpression; types.add(type[0]); // Create the right side of the multiplication expression expression.getRightExpression().accept(this); Expression rightExpression = queryExpression; types.add(type[0]); // Now create the multiplication expression queryExpression = ExpressionMath.multiply(leftExpression, rightExpression); // Set the expression type Collections.sort(types, NumericTypeComparator.instance()); type[0] = types.get(0); }
/** * INTERNAL * Generate the expression. The steps are: * 1. Generate the expression for the left node * 2. Add the .multiply to the where clause returned from step 1 * 3. Generate the expression for the right side and use it as the parameter for the .multiply() * 4. Return the completed where clause to the caller */ public Expression generateExpression(GenerationContext context) { Expression whereClause = getLeft().generateExpression(context); whereClause = ExpressionMath.multiply(whereClause, getRight().generateExpression(context)); return whereClause; }
/** * INTERNAL * Generate the expression. The steps are: * 1. Generate the expression for the left node * 2. Add the .multiply to the where clause returned from step 1 * 3. Generate the expression for the right side and use it as the parameter for the .multiply() * 4. Return the completed where clause to the caller */ public Expression generateExpression(GenerationContext context) { Expression whereClause = getLeft().generateExpression(context); whereClause = ExpressionMath.multiply(whereClause, getRight().generateExpression(context)); return whereClause; }
/** * INTERNAL * Generate the expression. The steps are: * 1. Generate the expression for the left node * 2. Add the .multiply to the where clause returned from step 1 * 3. Generate the expression for the right side and use it as the parameter for the .multiply() * 4. Return the completed where clause to the caller */ public Expression generateExpression(GenerationContext context) { Expression whereClause = getLeft().generateExpression(context); whereClause = ExpressionMath.multiply(whereClause, getRight().generateExpression(context)); return whereClause; }
/** * Create an expression that returns the product of its arguments. * * @param x * expression * @param y * value * @return product */ public <N extends Number> Expression<N> prod(Expression<? extends N> x, N y){ return new FunctionExpressionImpl(this.metamodel, (Class<N>)BasicTypeHelperImpl.getInstance().extendedBinaryNumericPromotion(x.getJavaType(), y.getClass()), ExpressionMath.multiply(((InternalSelection)x).getCurrentNode(),y), buildList(x,internalLiteral(y)), "prod"); }
/** * Create an expression that returns the product of its arguments. * * @param x * value * @param y * expression * @return product */ public <N extends Number> Expression<N> prod(N x, Expression<? extends N> y){ return new FunctionExpressionImpl(this.metamodel, (Class<N>)BasicTypeHelperImpl.getInstance().extendedBinaryNumericPromotion(x.getClass(), y.getJavaType()), ExpressionMath.multiply(new ConstantExpression(x, ((InternalSelection)y).getCurrentNode()),((InternalSelection)y).getCurrentNode()), buildList(internalLiteral(x),y), "prod"); }
/** * Create an expression that returns the product of its arguments. * * @param x * expression * @param y * expression * @return product */ public <N extends Number> Expression<N> prod(Expression<? extends N> x, Expression<? extends N> y){ return new FunctionExpressionImpl(this.metamodel, (Class<N>)BasicTypeHelperImpl.getInstance().extendedBinaryNumericPromotion(x.getJavaType(), y.getJavaType()), ExpressionMath.multiply(((InternalSelection)x).getCurrentNode(),((InternalSelection)y).getCurrentNode()), buildList(x,y), "prod"); }