001: /*
002: * $Header: /export/home/cvsroot/MyPersonalizerRepository/MyPersonalizer/Subsystems/Kernel/Sources/es/udc/mypersonalizer/kernel/model/query/ast/expr/ExpressionVisitor.java,v 1.1.1.1 2004/03/25 12:08:37 fbellas Exp $
003: * $Revision: 1.1.1.1 $
004: * $Date: 2004/03/25 12:08:37 $
005: *
006: * =============================================================================
007: *
008: * Copyright (c) 2003, The MyPersonalizer Development Group
009: * (http://www.tic.udc.es/~fbellas/mypersonalizer/index.html) at
010: * University Of A Coruna
011: * All rights reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions are met:
015: *
016: * - Redistributions of source code must retain the above copyright notice,
017: * this list of conditions and the following disclaimer.
018: *
019: * - Redistributions in binary form must reproduce the above copyright notice,
020: * this list of conditions and the following disclaimer in the documentation
021: * and/or other materials provided with the distribution.
022: *
023: * - Neither the name of the University Of A Coruna nor the names of its
024: * contributors may be used to endorse or promote products derived from
025: * this software without specific prior written permission.
026: *
027: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
028: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
029: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
030: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
031: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
032: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
033: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
034: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
035: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
036: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
037: * POSSIBILITY OF SUCH DAMAGE.
038: *
039: */
040: package es.udc.mypersonalizer.kernel.model.query.ast.expr;
041:
042: import es.udc.mypersonalizer.kernel.util.exceptions.VisitorException;
043:
044: /**
045: * Interface for visiting concrete <code>Expression</code>s (<em>Visitor</em>
046: * design pattern).
047: * <p>
048: * It defines a <code>visit()</code> method for each concrete
049: * <code>Expression</code>, which performs some operation on it and then
050: * returns some result.
051: * <p>
052: * Operations that do not return a value <em>must</em> return <code>null</code>.
053: * <p>
054: * <code>ExpressionVisitor</code>s can throw
055: * <code>UnsupportedOperationException</code> for visit methods that are not
056: * supposed to be called in correctly-written code (i.e. visitors are allowed
057: * to be aplicable only to a subset of expressions).
058: *
059: * @since 1.0
060: * @author Abel Muinho
061: */
062: public interface ExpressionVisitor {
063:
064: /**
065: * Visit method for a <code>LogicalAndExpression</code>.
066: * @param e the expression to visit.
067: * @return the result of the visit.
068: * @throws VisitorException if errors are found during the visit.
069: */
070: public Object visit(LogicalAndExpression e) throws VisitorException;
071:
072: /**
073: * Visit method for a <code>LogicalOrExpression</code>.
074: * @param e the expression to visit.
075: * @return the result of the visit.
076: * @throws VisitorException if errors are found during the visit.
077: */
078: public Object visit(LogicalOrExpression e) throws VisitorException;
079:
080: /**
081: * Visit method for a <code>EqualsExpression</code>.
082: * @param e the expression to visit.
083: * @return the result of the visit.
084: * @throws VisitorException if errors are found during the visit.
085: */
086: public Object visit(EqualsExpression e) throws VisitorException;
087:
088: /**
089: * Visit method for a <code>EqualsExpression</code>.
090: * @param e the expression to visit.
091: * @return the result of the visit.
092: * @throws VisitorException if errors are found during the visit.
093: */
094: public Object visit(NotEqualsExpression e) throws VisitorException;
095:
096: /**
097: * Visit method for a <code>LiteralBooleanExpression</code>.
098: * @param e the expression to visit.
099: * @return the result of the visit.
100: * @throws VisitorException if errors are found during the visit.
101: */
102: public Object visit(LiteralBooleanExpression e)
103: throws VisitorException;
104:
105: /**
106: * Visit method for a <code>LiteralNumericExpression</code>.
107: * @param e the expression to visit.
108: * @return the result of the visit.
109: * @throws VisitorException if errors are found during the visit.
110: */
111: public Object visit(LiteralNumericExpression e)
112: throws VisitorException;
113:
114: /**
115: * Visit method for a <code>LiteralStringExpression</code>.
116: * @param e the expression to visit.
117: * @return the result of the visit.
118: * @throws VisitorException if errors are found during the visit.
119: */
120: public Object visit(LiteralStringExpression e)
121: throws VisitorException;
122:
123: /**
124: * Visit method for a <code>PropertyListExpression</code>.
125: * @param e the expression to visit.
126: * @return the result of the visit.
127: * @throws VisitorException if errors are found during the visit.
128: */
129: public Object visit(PropertyListExpression e)
130: throws VisitorException;
131:
132: /**
133: * Visit method for a <code>MetaPropertyReferenceExpression</code>.
134: * @param e the expression to visit.
135: * @return the result of the visit.
136: * @throws VisitorException if errors are found during the visit.
137: */
138: public Object visit(StepExpression e) throws VisitorException;
139:
140: /**
141: * Visit method for a <code>ContainsFunctionExpression</code>.
142: * @param expression the expression to visit.
143: * @return the result of the visit.
144: * @throws VisitorException if errors are found during the visit.
145: */
146: public Object visit(ContainsFunctionExpression expression)
147: throws VisitorException;
148:
149: /**
150: * Visit method for a <code>StartsWithFunctionExpression</code>.
151: * @param expression the expression to visit.
152: * @return the result of the visit.
153: * @throws VisitorException if errors are found during the visit.
154: */
155: public Object visit(StartsWithFunctionExpression expression)
156: throws VisitorException;
157:
158: /**
159: * Visit method for a <code>GreaterThanExpression</code>.
160: * @param expression the expression to visit.
161: * @return the result of the visit.
162: * @throws VisitorException if errors are found during the visit.
163: */
164: public Object visit(GreaterThanExpression expression)
165: throws VisitorException;
166:
167: /**
168: * Visit method for a <code>LesserThanExpression</code>.
169: * @param expression the expression to visit.
170: * @return the result of the visit.
171: * @throws VisitorException if errors are found during the visit.
172: */
173: public Object visit(LesserThanExpression expression)
174: throws VisitorException;
175:
176: /**
177: * Visit method for a <code>GreaterOrEqualExpression</code>.
178: * @param expression the expression to visit.
179: * @return the result of the visit.
180: * @throws VisitorException if errors are found during the visit.
181: */
182: public Object visit(GreaterOrEqualExpression expression)
183: throws VisitorException;
184:
185: /**
186: * Visit method for a <code>LesserOrEqualExpression</code>.
187: * @param expression the expression to visit.
188: * @return the result of the visit.
189: * @throws VisitorException if errors are found during the visit.
190: */
191: public Object visit(LesserOrEqualExpression expression)
192: throws VisitorException;
193: }
|