001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 1998-2005 Julian Hyde
008// Copyright (C) 2005-2011 Pentaho and others
009// All Rights Reserved.
010*/
011package mondrian.olap;
012
013import java.io.PrintWriter;
014
015/**
016 * Component of an MDX query (derived classes include Query, Axis, Exp, Level).
017 *
018 * @author jhyde, 23 January, 1999
019 */
020public abstract class QueryPart implements Walkable {
021    /**
022     * Creates a QueryPart.
023     */
024    QueryPart() {
025    }
026
027    /**
028     * Writes a string representation of this parse tree
029     * node to the given writer.
030     *
031     * @param pw writer
032     */
033    public void unparse(PrintWriter pw) {
034        pw.print(toString());
035    }
036
037    // implement Walkable
038    public Object[] getChildren() {
039        // By default, a QueryPart is atomic (has no children).
040        return null;
041    }
042
043    /**
044     * Returns the plan that Mondrian intends to use to execute this query.
045     *
046     * @param pw Print writer
047     */
048    public void explain(PrintWriter pw) {
049        throw new UnsupportedOperationException(
050            "explain not implemented for " + this + " (" + getClass() + ")");
051    }
052}
053
054// End QueryPart.java