Debian Codegraph @

net/sf/saxon/expr/flwor/WhereClausePush.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 * This class represents the tuple stream delivered as the output of a where clause in a
16 * FLWOR expression: that is, it supplies all the tuples in its input stream that satisfy
17 * a specified predicate. It does not change the values of any variables in the tuple stream.
18 */
19 public class WhereClausePush extends TuplePush {
20
21 TuplePush destination;
22 Expression predicate;
23
24 public WhereClausePush(TuplePush destination, Expression predicate) {
25 this.destination = destination;
26 this.predicate = predicate;
27 }
28
29 /*
30 * Process the next tuple.
31 */
32 @Override
33 public void processTuple(XPathContext context) throws XPathException {
34 if (predicate.effectiveBooleanValue(context)) {
35 destination.processTuple(context);
36 }
37 }
38
39 /*
40 * Notify the end of the tuple stream
41 */
42 @Override
43 public void close() throws XPathException {
44 destination.close();
45 }
46 }
47