Debian Codegraph @

net/sf/saxon/expr/accum/AccumulatorRule.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.accum;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.instruct.SlotManager;
12 import net.sf.saxon.trace.ExpressionPresenter;
13 import net.sf.saxon.trans.rules.Rule;
14 import net.sf.saxon.trans.rules.RuleTarget;
15 import net.sf.saxon.trans.XPathException;
16
17 /**
18 * This class represents one of the rules making up the definition of an accumulator
19 */
20
21 public class AccumulatorRule implements RuleTarget {
22
23 private Expression newValueExpression;
24 private SlotManager stackFrameMap;
25 private boolean postDescent;
26 private boolean capturing;
27
28 /**
29 * Create a rule
30 *
31 * @param newValueExpression the expression that computes a new value of the accumulator function
32 * @param stackFrameMap the stack frame used to evaluate this expression
33 */
34
35 public AccumulatorRule(Expression newValueExpression, SlotManager stackFrameMap, boolean postDescent) {
36 this.newValueExpression = newValueExpression;
37 this.stackFrameMap = stackFrameMap;
38 this.postDescent = postDescent;
39 }
40
41 public Expression getNewValueExpression() {
42 return newValueExpression;
43 }
44
45 public void export(ExpressionPresenter out) throws XPathException {
46 newValueExpression.export(out);
47 }
48
49 public SlotManager getStackFrameMap() {
50 return stackFrameMap;
51 }
52
53 /**
54 * Register a rule for which this is the target
55 *
56 * @param rule a rule in which this is the target
57 */
58 public void registerRule(Rule rule) {
59 // no action
60 }
61
62 public void setCapturing(boolean capturing) {
63 this.capturing = capturing;
64 }
65
66 public boolean isCapturing() {
67 return capturing;
68 }
69
70 public boolean isPostDescent() {
71 return postDescent;
72 }
73 }