// Static function
if (method.toLowerCase().equals("count"))
{
Collection coll = (Collection)state.get(JavaQueryEvaluator.RESULTS_SET);
SetExpression setexpr = new SetExpression(coll, candidateAlias);
Expression paramExpr = invokeExpr.getArguments().get(0);
if (paramExpr.getOperator() == Expression.OP_DISTINCT)
{
Collection processable = new HashSet(coll); // No dups in HashSet
coll = processable;
}
return setexpr.count(paramExpr, this);
}
else if (method.toLowerCase().equals("sum"))
{
Collection coll = (Collection)state.get(JavaQueryEvaluator.RESULTS_SET);
SetExpression setexpr = new SetExpression(coll, candidateAlias);
Expression paramExpr = invokeExpr.getArguments().get(0);
if (paramExpr.getOperator() == Expression.OP_DISTINCT)
{
Collection processable = new HashSet(coll); // No dups in HashSet
coll = processable;
}
return setexpr.sum(paramExpr, this, state);
}
else if (method.toLowerCase().equals("avg"))
{
Collection coll = (Collection)state.get(JavaQueryEvaluator.RESULTS_SET);
SetExpression setexpr = new SetExpression(coll, candidateAlias);
Expression paramExpr = invokeExpr.getArguments().get(0);
if (paramExpr.getOperator() == Expression.OP_DISTINCT)
{
Collection processable = new HashSet(coll); // No dups in HashSet
coll = processable;
}
return setexpr.avg(paramExpr, this, state);
}
else if (method.toLowerCase().equals("min"))
{
Collection coll = (Collection)state.get(JavaQueryEvaluator.RESULTS_SET);
SetExpression setexpr = new SetExpression(coll, candidateAlias);
Expression paramExpr = invokeExpr.getArguments().get(0);
if (paramExpr.getOperator() == Expression.OP_DISTINCT)
{
Collection processable = new HashSet(coll); // No dups in HashSet
coll = processable;
}
return setexpr.min(paramExpr, this, state);
}
else if (method.toLowerCase().equals("max"))
{
Collection coll = (Collection)state.get(JavaQueryEvaluator.RESULTS_SET);
SetExpression setexpr = new SetExpression(coll, candidateAlias);
Expression paramExpr = invokeExpr.getArguments().get(0);
if (paramExpr.getOperator() == Expression.OP_DISTINCT)
{
Collection processable = new HashSet(coll); // No dups in HashSet
coll = processable;
}
return setexpr.max(paramExpr, this, state);