Debian Codegraph @

net/sf/saxon/expr/flwor/ReturnClausePush.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.expr.flwor;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.XPathContext;
12 import net.sf.saxon.trans.XPathException;
13
14 /**
15 * The class represents the final stage in a push-mode tuple pipeline. The previous stages
16 * have stored the values corresponding to the current tuple in local variables on the
17 * stack; all that remains is to evaluate the return expression (with reference to these
18 * variables) and send the results to the current receiver.
19 */
20 public class ReturnClausePush extends TuplePush {
21
22 private Expression returnExpr;
23
24 public ReturnClausePush(Expression returnExpr) {
25 this.returnExpr = returnExpr;
26 }
27
28 /**
29 * Notify the availability of the next tuple. Before calling this method,
30 * the supplier of the tuples must set all the variables corresponding
31 * to the supplied tuple in the local stack frame associated with the context object
32 *
33 * @param context the dynamic evaluation context
34 */
35 @Override
36 public void processTuple(XPathContext context) throws XPathException {
37 returnExpr.process(context);
38 }
39
40 /**
41 * Close the tuple stream, indicating that no more tuples will be supplied
42 */
43 @Override
44 public void close() throws XPathException {
45 // no action
46 }
47 }
48