KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.xquark.xml.xqueryparser.common.primitivefunctions.*;
26

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

50     public void visit(Element arg) throws XQueryException {
51         if (arg.getSkolemIDs() != null)
52             arg.getSkolemIDs().remove(var);
53         ArrayList JavaDoc subExpressions = arg.getSubExpressions();
54         if (subExpressions != null)
55             for (int i = 0; i < subExpressions.size(); i++)
56                  ((XQueryExpression) subExpressions.get(i)).accept(this);
57     }
58
59     // public void visit(FLWRExpression arg) throws XQueryException;
60
// public void visit(FunctionCall arg) throws XQueryException;
61
// public void visit(FunctionDefinition arg) throws XQueryException;
62
// public void visit(InstanceOfExpression arg) throws XQueryException;
63
// public void visit(InternalFunctionCall arg) throws XQueryException;
64
public void visit(ITEExpression arg) throws XQueryException {
65         if (arg.getSkolemIDs() != null)
66             arg.getSkolemIDs().remove(var);
67     }
68     // public void visit(LibraryFunctionCall arg) throws XQueryException;
69
// public void visit(ListOpAFTERExpression arg) throws XQueryException;
70
// public void visit(ListOpArithExpression arg) throws XQueryException;
71
// public void visit(ListOpBEFOREExpression arg) throws XQueryException;
72
// public void visit(ListOpCompExpression arg) throws XQueryException;
73
// public void visit(ListOpEXCEPTExpression arg) throws XQueryException;
74
// public void visit(ListOpINTERSECTExpression arg) throws XQueryException;
75
// public void visit(ListOpUNIONExpression arg) throws XQueryException;
76
// public void visit(LocatedExpression arg) throws XQueryException {
77
// if (arg.getSkolemIDs() != null) arg.getSkolemIDs().remove(var);
78
// }
79
// public void visit(NodeType arg) throws XQueryException;
80
// public void visit(Parameter arg) throws XQueryException;
81
// public void visit(PrimitiveFunctionCall arg) throws XQueryException;
82
// public void visit(QName arg) throws XQueryException;
83
// public void visit(QuantifiedExpression arg) throws XQueryException;
84
// public void visit(RangeExpression arg) throws XQueryException;
85
// public void visit(RootNodeFunctionCall arg) throws XQueryException;
86
// public void visit(SortedExpression arg) throws XQueryException;
87
// public void visit(Step arg) throws XQueryException;
88
// public void visit(TypeSwitchExpression arg) throws XQueryException;
89
// public void visit(UnOpMinusExpression arg) throws XQueryException;
90
// public void visit(Value arg) throws XQueryException;
91
// public void visit(ValueBoolean arg) throws XQueryException;
92
// public void visit(ValueFloat arg) throws XQueryException;
93
// public void visit(ValueInteger arg) throws XQueryException;
94
// public void visit(ValueString arg) throws XQueryException;
95
// public void visit(ValueText arg) throws XQueryException;
96
// public void visit(Variable arg) throws XQueryException {
97
// if (arg.getSkolemIDs() != null) arg.getSkolemIDs().remove(var);
98
// }
99
// public void visit(XQueryBinaryOperatorExpression arg) throws XQueryException;
100
public void visit(XQueryBinaryOperatorExpression arg) throws XQueryException {
101         if (arg.getSkolemIDs() != null)
102             arg.getSkolemIDs().remove(var);
103         arg.getExpression1().accept(this);
104         arg.getExpression2().accept(this);
105     }
106     // public void visit(XQueryBooleanOperatorExpression arg) throws XQueryException;
107
// public void visit(XQueryExpression arg) throws XQueryException;
108

109     public void visit(XQueryExpressionSequence arg) throws XQueryException {
110         if (arg.getSkolemIDs() != null)
111             arg.getSkolemIDs().remove(var);
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         if (arg.getSkolemIDs() != null)
122             arg.getSkolemIDs().remove(var);
123         arg.getExpression().accept(this);
124     }
125     // public void visit(XQueryUnit arg) throws XQueryException;
126
// public void visit(XQueryVoid arg) throws XQueryException;
127

128     // primitive functions
129

130 }
131
Popular Tags