KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > query > UndeclaredVariable


1 package net.sf.saxon.query;
2
3 import net.sf.saxon.expr.BindingReference;
4 import net.sf.saxon.expr.VariableDeclaration;
5 import net.sf.saxon.instruct.GlobalVariable;
6 import net.sf.saxon.trans.XPathException;
7
8 import java.util.Collections JavaDoc;
9 import java.util.Iterator JavaDoc;
10
11 /**
12  * An UndeclaredVariable object is created when a reference is encountered to a variable
13  * that has not yet been declared. This can happen as a result of recursive module imports.
14  * These references are resolved at the end of query parsing.
15  */

16
17 public class UndeclaredVariable extends GlobalVariableDefinition {
18
19     public void transferReferences(VariableDeclaration var) {
20         Iterator JavaDoc iter = references.iterator();
21         while (iter.hasNext()) {
22             BindingReference ref = (BindingReference)iter.next();
23             var.registerReference(ref);
24         }
25         references = Collections.EMPTY_LIST;
26     }
27
28     public GlobalVariable compile(StaticQueryContext env, int slot) throws XPathException {
29         throw new UnsupportedOperationException JavaDoc("Attempt to compile a place-holder for an undeclared variable");
30     }
31 }
32
33 //
34
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
35
// you may not use this file except in compliance with the License. You may obtain a copy of the
36
// License at http://www.mozilla.org/MPL/
37
//
38
// Software distributed under the License is distributed on an "AS IS" basis,
39
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
40
// See the License for the specific language governing rights and limitations under the License.
41
//
42
// The Original Code is: all this file.
43
//
44
// The Initial Developer of the Original Code is Michael H. Kay
45
//
46
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
47
//
48
// Contributor(s): none
49
//
50
Popular Tags