coalesceemptyfundef.java
来自「数据仓库展示程序」· Java 代码 · 共 45 行
JAVA
45 行
/*
// $Id: //open/mondrian/src/main/mondrian/olap/fun/CoalesceEmptyFunDef.java#3 $
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// (C) Copyright 2004-2005 Julian Hyde and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
package mondrian.olap.fun;
import mondrian.olap.*;
/**
* The <code>CoalesceEmptyFunDef</code> class implements the CoalesceEmpty(...)
* MDX function. It evaluates each of the arguments to the function, returning the
* first such argument that does not return a null value.
*
* @author gjohnson
*/
public class CoalesceEmptyFunDef extends FunDefBase {
public CoalesceEmptyFunDef(ResolverBase resolverBase, int type, int[] types) {
super(resolverBase, type, types);
}
/**
* @param evaluator The evaluation context.
* @param args The arguments to <code>CoalesceEmpty</code>
* @return The first non-null argument, or null if all arguments are null.
*/
public Object evaluate(Evaluator evaluator, Exp[] args) {
for (int idx = 0; idx < args.length; idx++) {
Object argument = getScalarArg(evaluator, args, idx);
// Evaluator current = evaluator.push();
// Object argument = getScalarArg(current, args, idx);
if (argument != null && argument != Util.nullValue) {
return argument;
}
}
return null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?