001 /* 002 // $Id: ParseTreeWriter.java 229 2009-05-08 19:11:29Z jhyde $ 003 // This software is subject to the terms of the Eclipse Public License v1.0 004 // Agreement, available at the following URL: 005 // http://www.eclipse.org/legal/epl-v10.html. 006 // Copyright (C) 2007-2008 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package org.olap4j.mdx; 011 012 import java.io.PrintWriter; 013 014 /** 015 * Writer for MDX parse tree. 016 * 017 * <p>Typical use is with the {@link ParseTreeNode#unparse(ParseTreeWriter)} 018 * method as follows: 019 * 020 * <blockquote> 021 * <pre> 022 * ParseTreeNode node; 023 * StringWriter sw = new StringWriter(); 024 * PrintWriter pw = new PrintWriter(sw); 025 * ParseTreeWriter mdxWriter = new ParseTreeWriter(pw); 026 * node.unparse(mdxWriter); 027 * pw.flush(); 028 * String mdx = sw.toString(); 029 * </pre> 030 * </blockquote> 031 * 032 * 033 * @see org.olap4j.mdx.ParseTreeNode#unparse(ParseTreeWriter) 034 * 035 * @author jhyde 036 * @version $Id: ParseTreeWriter.java 229 2009-05-08 19:11:29Z jhyde $ 037 * @since Jun 4, 2007 038 */ 039 public class ParseTreeWriter { 040 private final PrintWriter pw; 041 042 /** 043 * Creates a ParseTreeWriter. 044 * 045 * @param pw Underlying writer 046 */ 047 public ParseTreeWriter(PrintWriter pw) { 048 this.pw = pw; 049 } 050 051 /** 052 * Returns the underlying writer. 053 * 054 * @return underlying writer 055 */ 056 public PrintWriter getPrintWriter() { 057 return pw; 058 } 059 } 060 061 // End ParseTreeWriter.java