Debian Codegraph @

net/sf/saxon/expr/flwor/LetClausePush.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.XPathContext;
11 import net.sf.saxon.om.Sequence;
12 import net.sf.saxon.trans.XPathException;
13
14 /**
15 * Implements the changes to a tuple stream effected by the Let clause in a FLWOR expression
16 */
17 public class LetClausePush extends TuplePush {
18
19 TuplePush destination;
20 LetClause letClause;
21
22 public LetClausePush(TuplePush destination, LetClause letClause) {
23 this.destination = destination;
24 this.letClause = letClause;
25 }
26
27 /*
28 * Notify the next tuple.
29 */
30 @Override
31 public void processTuple(XPathContext context) throws XPathException {
32 Sequence<?> val = letClause.getEvaluator().evaluate(letClause.getSequence(), context);
33 context.setLocalVariable(letClause.getRangeVariable().getLocalSlotNumber(), val);
34 destination.processTuple(context);
35 }
36
37 /*
38 * Close the tuple stream
39 */
40 @Override
41 public void close() throws XPathException {
42 destination.close();
43 }
44 }
45