public SimpleNode splitForAggregation(AggregateProjectionSplit aggregateProj, OCommandContext ctx) { if (isAggregate()) { OMathExpression result = new OMathExpression(-1); int i = 0; for (OMathExpression expr : this.childExpressions) { if (i > 0) { result.operators.add(operators.get(i - 1)); } SimpleNode splitResult = expr.splitForAggregation(aggregateProj, ctx); if (splitResult instanceof OMathExpression) { OMathExpression res = (OMathExpression) splitResult; if (res.isEarlyCalculated(ctx) || res.isAggregate()) { result.childExpressions.add(res); } else { throw new OCommandExecutionException("Cannot mix aggregate and single record attribute values in the same projection"); } } else if (splitResult instanceof OExpression) { result.childExpressions.add(((OExpression) splitResult).mathExpression);//this comes from a splitted aggregate function } i++; } return result; } else { return this; } }
private Object calculateNewValue(OResultInternal doc, OCommandContext ctx, OMathExpression.Operator explicitOperator) { OExpression leftEx = new OExpression(left.copy()); if (leftModifier != null) { ((OBaseExpression) leftEx.mathExpression).modifier = leftModifier.copy(); } OMathExpression mathExp = new OMathExpression(-1); mathExp.getChildExpressions().add(leftEx.getMathExpression()); mathExp.getChildExpressions().add(new OParenthesisExpression(right.copy())); mathExp.getOperators().add(explicitOperator); return mathExp.execute(doc, ctx); }
public void deserialize(OResult fromResult) { if (fromResult.getProperty("inputValue") != null) { inputValue = OInputParameter.deserializeFromOResult(fromResult.getProperty("inputValue")); } if (fromResult.getProperty("toSelector") != null) { expressionValue = new OMathExpression(-1); expressionValue.deserialize(fromResult.getProperty("expressionValue")); } integer = fromResult.getProperty("integer"); } }
final public OMathExpression MathExpression() throws ParseException { OMathExpression jjtn000 = new OMathExpression(JJTMATHEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);