001 /*
002 // $Id: ParseTreeVisitor.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 /**
013 * Interface for a visitor to an MDX parse tree.
014 *
015 * <p>Together with the
016 * {@link org.olap4j.mdx.ParseTreeNode#accept(ParseTreeVisitor)} method, an
017 * class implementing this interface implements a visitor pattern, to allow
018 * an algorithm to efficiently traverse a parse tree and perform an action at
019 * each node dependent upon the type of each node.
020 *
021 * @author jhyde
022 * @version $Id: ParseTreeVisitor.java 229 2009-05-08 19:11:29Z jhyde $
023 * @since Jul 21, 2006
024 */
025 public interface ParseTreeVisitor<T> {
026 /**
027 * Visits a select statement.
028 *
029 * @param selectNode Node representing a select statement
030 *
031 * @return value yielded by visiting the node
032 *
033 * @see SelectNode#accept(ParseTreeVisitor)
034 */
035 T visit(SelectNode selectNode);
036
037 /**
038 * Visits an axis of a select statement.
039 *
040 * @param axis Node representing an axis
041 *
042 * @return value yielded by visiting the node
043 *
044 * @see AxisNode#accept(ParseTreeVisitor)
045 */
046 T visit(AxisNode axis);
047
048 /**
049 * Visits a member declaration.
050 *
051 * @param calcMemberNode Node representing a member declaration
052 *
053 * @return value yielded by visiting the node
054 *
055 * @see WithMemberNode#accept(ParseTreeVisitor)
056 */
057 T visit(WithMemberNode calcMemberNode);
058
059 /**
060 * Visits a set declaration.
061 *
062 * @param calcSetNode Node representing a set declaration
063 *
064 * @return value yielded by visiting the node
065 *
066 * @see WithSetNode#accept(ParseTreeVisitor)
067 */
068 T visit(WithSetNode calcSetNode);
069
070 /**
071 * Visits a call to an operator or function.
072 *
073 * @param call Node representing a call to an operator or function
074 *
075 * @see CallNode#accept(ParseTreeVisitor)
076 *
077 * @return value yielded by visiting the node
078 */
079 T visit(CallNode call);
080
081 /**
082 * Visits an identifier.
083 *
084 * @param id Node representing an identifier
085 *
086 * @return value yielded by visiting the node
087 *
088 * @see IdentifierNode#accept(ParseTreeVisitor)
089 */
090 T visit(IdentifierNode id);
091
092 /**
093 * Visits a parameter.
094 *
095 * @param parameterNode Node representing use of a parameter
096 *
097 * @return value yielded by visiting the node
098 *
099 * @see ParameterNode#accept(ParseTreeVisitor)
100 */
101 T visit(ParameterNode parameterNode);
102
103 /**
104 * Visits a use of a {@link org.olap4j.metadata.Cube}
105 * in a select statement.
106 *
107 * @param cubeNode Node representing a use of a Cube
108 *
109 * @return value yielded by visiting the node
110 *
111 * @see CubeNode#accept(ParseTreeVisitor)
112 */
113 T visit(CubeNode cubeNode);
114
115 /**
116 * Visits a use of a {@link org.olap4j.metadata.Dimension}
117 * in a select statement.
118 *
119 * @param dimensionNode Node representing a use of a Dimension
120 *
121 * @return value yielded by visiting the node
122 *
123 * @see DimensionNode#accept(ParseTreeVisitor)
124 */
125 T visit(DimensionNode dimensionNode);
126
127 /**
128 * Visits a use of a {@link org.olap4j.metadata.Hierarchy}
129 * in a select statement.
130 *
131 * @param hierarchyNode Node representing a use of a Hierarchy
132 *
133 * @return value yielded by visiting the node
134 *
135 * @see HierarchyNode#accept(ParseTreeVisitor)
136 */
137 T visit(HierarchyNode hierarchyNode);
138
139 /**
140 * Visits a use of a {@link org.olap4j.metadata.Level}
141 * in a select statement.
142 *
143 * @param levelNode Node representing a use of a Level
144 *
145 * @return value yielded by visiting the node
146 *
147 * @see LevelNode#accept(ParseTreeVisitor)
148 */
149 T visit(LevelNode levelNode);
150
151 /**
152 * Visits a use of a {@link org.olap4j.metadata.Member}
153 * in a select statement.
154 *
155 * @param memberNode Node representing a use of a Member
156 *
157 * @return value yielded by visiting the node
158 *
159 * @see MemberNode#accept(ParseTreeVisitor)
160 */
161 T visit(MemberNode memberNode);
162
163 /**
164 * Visits a literal.
165 *
166 * @param literalNode Node representing a Literal
167 *
168 * @return value yielded by visiting the node
169 *
170 * @see LiteralNode#accept(ParseTreeVisitor)
171 */
172 T visit(LiteralNode literalNode);
173
174 /**
175 * Visits a property-value pair.
176 *
177 * @param propertyValueNode Node representing a property-value pair
178 *
179 * @return value yielded by visiting the node
180 *
181 * @see PropertyValueNode#accept(ParseTreeVisitor)
182 */
183 T visit(PropertyValueNode propertyValueNode);
184 }
185
186 // End ParseTreeVisitor.java