001 /*
002 // $Id: ParseTreeVisitor.java 482 2012-01-05 23:27:27Z jhyde $
003 //
004 // Licensed to Julian Hyde under one or more contributor license
005 // agreements. See the NOTICE file distributed with this work for
006 // additional information regarding copyright ownership.
007 //
008 // Julian Hyde licenses this file to you under the Apache License,
009 // Version 2.0 (the "License"); you may not use this file except in
010 // compliance with the License. You may obtain a copy of the License at:
011 //
012 // http://www.apache.org/licenses/LICENSE-2.0
013 //
014 // Unless required by applicable law or agreed to in writing, software
015 // distributed under the License is distributed on an "AS IS" BASIS,
016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 // See the License for the specific language governing permissions and
018 // limitations under the License.
019 */
020 package org.olap4j.mdx;
021
022 /**
023 * Interface for a visitor to an MDX parse tree.
024 *
025 * <p>Together with the
026 * {@link org.olap4j.mdx.ParseTreeNode#accept(ParseTreeVisitor)} method, an
027 * class implementing this interface implements a visitor pattern, to allow
028 * an algorithm to efficiently traverse a parse tree and perform an action at
029 * each node dependent upon the type of each node.
030 *
031 * @author jhyde
032 * @version $Id: ParseTreeVisitor.java 482 2012-01-05 23:27:27Z jhyde $
033 * @since Jul 21, 2006
034 */
035 public interface ParseTreeVisitor<T> {
036 /**
037 * Visits a select statement.
038 *
039 * @param selectNode Node representing a select statement
040 *
041 * @return value yielded by visiting the node
042 *
043 * @see SelectNode#accept(ParseTreeVisitor)
044 */
045 T visit(SelectNode selectNode);
046
047 /**
048 * Visits an axis of a select statement.
049 *
050 * @param axis Node representing an axis
051 *
052 * @return value yielded by visiting the node
053 *
054 * @see AxisNode#accept(ParseTreeVisitor)
055 */
056 T visit(AxisNode axis);
057
058 /**
059 * Visits a member declaration.
060 *
061 * @param calcMemberNode Node representing a member declaration
062 *
063 * @return value yielded by visiting the node
064 *
065 * @see WithMemberNode#accept(ParseTreeVisitor)
066 */
067 T visit(WithMemberNode calcMemberNode);
068
069 /**
070 * Visits a set declaration.
071 *
072 * @param calcSetNode Node representing a set declaration
073 *
074 * @return value yielded by visiting the node
075 *
076 * @see WithSetNode#accept(ParseTreeVisitor)
077 */
078 T visit(WithSetNode calcSetNode);
079
080 /**
081 * Visits a call to an operator or function.
082 *
083 * @param call Node representing a call to an operator or function
084 *
085 * @see CallNode#accept(ParseTreeVisitor)
086 *
087 * @return value yielded by visiting the node
088 */
089 T visit(CallNode call);
090
091 /**
092 * Visits an identifier.
093 *
094 * @param id Node representing an identifier
095 *
096 * @return value yielded by visiting the node
097 *
098 * @see IdentifierNode#accept(ParseTreeVisitor)
099 */
100 T visit(IdentifierNode id);
101
102 /**
103 * Visits a parameter.
104 *
105 * @param parameterNode Node representing use of a parameter
106 *
107 * @return value yielded by visiting the node
108 *
109 * @see ParameterNode#accept(ParseTreeVisitor)
110 */
111 T visit(ParameterNode parameterNode);
112
113 /**
114 * Visits a use of a {@link org.olap4j.metadata.Cube}
115 * in a select statement.
116 *
117 * @param cubeNode Node representing a use of a Cube
118 *
119 * @return value yielded by visiting the node
120 *
121 * @see CubeNode#accept(ParseTreeVisitor)
122 */
123 T visit(CubeNode cubeNode);
124
125 /**
126 * Visits a use of a {@link org.olap4j.metadata.Dimension}
127 * in a select statement.
128 *
129 * @param dimensionNode Node representing a use of a Dimension
130 *
131 * @return value yielded by visiting the node
132 *
133 * @see DimensionNode#accept(ParseTreeVisitor)
134 */
135 T visit(DimensionNode dimensionNode);
136
137 /**
138 * Visits a use of a {@link org.olap4j.metadata.Hierarchy}
139 * in a select statement.
140 *
141 * @param hierarchyNode Node representing a use of a Hierarchy
142 *
143 * @return value yielded by visiting the node
144 *
145 * @see HierarchyNode#accept(ParseTreeVisitor)
146 */
147 T visit(HierarchyNode hierarchyNode);
148
149 /**
150 * Visits a use of a {@link org.olap4j.metadata.Level}
151 * in a select statement.
152 *
153 * @param levelNode Node representing a use of a Level
154 *
155 * @return value yielded by visiting the node
156 *
157 * @see LevelNode#accept(ParseTreeVisitor)
158 */
159 T visit(LevelNode levelNode);
160
161 /**
162 * Visits a use of a {@link org.olap4j.metadata.Member}
163 * in a select statement.
164 *
165 * @param memberNode Node representing a use of a Member
166 *
167 * @return value yielded by visiting the node
168 *
169 * @see MemberNode#accept(ParseTreeVisitor)
170 */
171 T visit(MemberNode memberNode);
172
173 /**
174 * Visits a literal.
175 *
176 * @param literalNode Node representing a Literal
177 *
178 * @return value yielded by visiting the node
179 *
180 * @see LiteralNode#accept(ParseTreeVisitor)
181 */
182 T visit(LiteralNode literalNode);
183
184 /**
185 * Visits a property-value pair.
186 *
187 * @param propertyValueNode Node representing a property-value pair
188 *
189 * @return value yielded by visiting the node
190 *
191 * @see PropertyValueNode#accept(ParseTreeVisitor)
192 */
193 T visit(PropertyValueNode propertyValueNode);
194 }
195
196 // End ParseTreeVisitor.java