KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > xquery > normalize > PutSkolemIDsVisitor


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.xquery.normalize;
24
25 import java.util.ArrayList JavaDoc;
26
27 import org.xquark.xquery.parser.*;
28
29 public class PutSkolemIDsVisitor extends DefaultParserVisitor {
30
31     private static final String JavaDoc RCSRevision = "$Revision: 1.1 $";
32     private static final String JavaDoc RCSName = "$Name: $";
33
34     private ArrayList JavaDoc ids = null;
35     
36     public PutSkolemIDsVisitor(ArrayList JavaDoc ids) { this.ids = ids; }
37     
38     // public void visit(AggregateFunctionCall arg) throws XQueryException
39
// public void visit(AttributeValuePair arg) throws XQueryException;
40
// public void visit(BinOpANDExpression arg) throws XQueryException;
41
// public void visit(BinOpORExpression arg) throws XQueryException;
42
// public void visit(CastTreatExpression arg) throws XQueryException;
43
// public void visit(ContextDeclaration arg) throws XQueryException;
44
// public void visit(Dereference arg) throws XQueryException;
45

46     public void visit(Element arg) throws XQueryException {
47         // DANGER !!!
48
// there is no iteration when the skolem is not empty
49
// because skolem ids in the sub expressions are the same as
50
// in the main expression and are contained in the same list(!!!)
51
//boolean nosub = false;
52
//if (arg.getSkolemIDs() != null) nosub = true;
53
arg.setSkolemIDs(ids);
54         //if (!nosub) {
55
ArrayList JavaDoc subExpressions = arg.getSubExpressions();
56             if (subExpressions != null) {
57                 for (int i=0;i<subExpressions.size();i++)
58                     ((XQueryExpression)subExpressions.get(i)).accept(this);
59             }
60         //}
61
}
62     
63     // public void visit(FLWRExpression arg) throws XQueryException;
64
// public void visit(FunctionCall arg) throws XQueryException;
65
// public void visit(FunctionDefinition arg) throws XQueryException;
66
// public void visit(InstanceOfExpression arg) throws XQueryException;
67
// public void visit(InternalFunctionCall arg) throws XQueryException;
68
public void visit(ITEExpression arg) throws XQueryException {
69         arg.setSkolemIDs(ids);
70     }
71     // public void visit(LibraryFunctionCall arg) throws XQueryException;
72
// public void visit(ListOpAFTERExpression arg) throws XQueryException;
73
// public void visit(ListOpArithExpression arg) throws XQueryException;
74
// public void visit(ListOpBEFOREExpression arg) throws XQueryException;
75
// public void visit(ListOpCompExpression arg) throws XQueryException;
76
// public void visit(ListOpEXCEPTExpression arg) throws XQueryException;
77
// public void visit(ListOpINTERSECTExpression arg) throws XQueryException;
78
// public void visit(ListOpUNIONExpression arg) throws XQueryException;
79
// public void visit(LocatedExpression arg) throws XQueryException {
80
// arg.setSkolemIDs(ids);
81
// }
82
// public void visit(NodeType arg) throws XQueryException;
83
// public void visit(Parameter arg) throws XQueryException;
84
// public void visit(PrimitiveFunctionCall arg) throws XQueryException;
85
// public void visit(QName arg) throws XQueryException;
86
// public void visit(QuantifiedExpression arg) throws XQueryException;
87
// public void visit(RangeExpression arg) throws XQueryException;
88
// public void visit(RootNodeFunctionCall arg) throws XQueryException;
89
// public void visit(SortedExpression arg) throws XQueryException;
90
// public void visit(Step arg) throws XQueryException;
91
// public void visit(TypeSwitchExpression arg) throws XQueryException;
92
// public void visit(UnOpMinusExpression arg) throws XQueryException;
93
// public void visit(Value arg) throws XQueryException;
94
// public void visit(ValueBoolean arg) throws XQueryException;
95
// public void visit(ValueFloat arg) throws XQueryException;
96
// public void visit(ValueInteger arg) throws XQueryException;
97
// public void visit(ValueString arg) throws XQueryException;
98
// public void visit(ValueText arg) throws XQueryException;
99
// public void visit(Variable arg) throws XQueryException {
100
// arg.setSkolemIDs(ids);
101
// }
102
public void visit(XQueryBinaryOperatorExpression arg) throws XQueryException {
103         arg.setSkolemIDs(ids);
104         arg.getExpression1().accept(this);
105         arg.getExpression2().accept(this);
106     }
107     // public void visit(XQueryBooleanOperatorExpression arg) throws XQueryException;
108
// public void visit(XQueryExpression arg) throws XQueryException;
109

110     public void visit(XQueryExpressionSequence arg) throws XQueryException {
111         arg.setSkolemIDs(ids);
112         ArrayList JavaDoc subExpressions = arg.getSubExpressions();
113         for (int i=0;i<subExpressions.size();i++)
114             ((XQueryExpression)subExpressions.get(i)).accept(this);
115     }
116     
117     // public void visit(XQueryFile arg) throws XQueryException;
118
// public void visit(XQueryListBinaryOperatorExpression arg) throws XQueryException;
119
// public void visit(XQueryListUnaryOperatorExpression arg) throws XQueryException;
120
public void visit(XQueryUnaryOperatorExpression arg) throws XQueryException {
121         arg.setSkolemIDs(ids);
122         arg.getExpression().accept(this);
123     }
124     // public void visit(XQueryUnit arg) throws XQueryException;
125
// public void visit(XQueryVoid arg) throws XQueryException;
126

127     // primitive functions
128

129     // public void visit(FunctionATTRIBUTE arg) throws XQueryException ;
130
// public void visit(FunctionAVG arg) throws XQueryException ;
131
// public void visit(FunctionCOLLECTION arg) throws XQueryException;
132
// public void visit(FunctionCONTAINS arg) throws XQueryException;
133
// public void visit(FunctionCOUNT arg) throws XQueryException;
134
// public void visit(FunctionDATA arg) throws XQueryException;
135
// public void visit(FunctionDISTINCT_VALUES arg) throws XQueryException;
136
// public void visit(FunctionDOCUMENT arg) throws XQueryException;
137
// public void visit(FunctionEMPTY arg) throws XQueryException;
138
// public void visit(FunctionFILTER arg) throws XQueryException;
139
// public void visit(FunctionMAX arg) throws XQueryException;
140
// public void visit(FunctionMIN arg) throws XQueryException;
141
// public void visit(FunctionNAME arg) throws XQueryException;
142
// public void visit(FunctionNOT arg) throws XQueryException;
143
// public void visit(FunctionNUMBER arg) throws XQueryException;
144
// public void visit(FunctionPART arg) throws XQueryException;
145
// public void visit(FunctionPOSITION arg) throws XQueryException;
146
// public void visit(FunctionSHALLOW arg) throws XQueryException;
147
// public void visit(FunctionSTRING arg) throws XQueryException;
148
// public void visit(FunctionSTRINGVALUE arg) throws XQueryException;
149
// public void visit(FunctionSUM arg) throws XQueryException;
150
// public void visit(FunctionTEXT arg) throws XQueryException;
151
}
152
Popular Tags