querypart.java

来自「数据仓库展示程序」· Java 代码 · 共 61 行

JAVA
61
字号
/*
// $Id: //open/mondrian/src/main/mondrian/olap/QueryPart.java#7 $
// 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 1998-2005 Kana Software, Inc. and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// jhyde, 23 January, 1999
*/

package mondrian.olap;
import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Component of an MDX query (derived classes include Query, Axis, Exp, Level).
 **/
public abstract class QueryPart implements Walkable {
    QueryPart() {
    }

    /**
     * Converts this query or expression into an MDX string.
     */
    public String toMdx()
    {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        unparse(pw);
        return sw.toString();
    }

    public void unparse(PrintWriter pw) {
        pw.print(toString());
    }

    /**
     * Replaces the <code>ordinal</code>th child (as it appeared in the array
     * returned from {@link #getChildren}) with <code>with</code>.
     */
    public void replaceChild(int ordinal, QueryPart with) {
        // By default, a QueryPart is atomic (has no children).
        throw new Error("unsupported");
    }

    // implement Walkable
    public Object[] getChildren() {
        // By default, a QueryPart is atomic (has no children).
        return null;
    }

    protected Object[] getAllowedChildren(CubeAccess cubeAccess) {
        // By default, a QueryPart is atomic (has no children).
        return null;
    }
}

// End QueryPart.java

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?