Debian Codegraph @

net/sf/saxon/expr/accum/VirtualAccumulatorData.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.om.NodeInfo;
11 import net.sf.saxon.om.Sequence;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.tree.wrapper.VirtualCopy;
14
15 /**
16 * Holds the values of an accumulator function for a virtual copy of a document (where the accumulator values
17 * are copies of those on the underlying document)
18 */
19 public class VirtualAccumulatorData implements IAccumulatorData {
20
21 private IAccumulatorData realData;
22
23 public VirtualAccumulatorData(IAccumulatorData realData) {
24 this.realData = realData;
25 }
26
27 public Accumulator getAccumulator() {
28 return realData.getAccumulator();
29 }
30
31 /**
32 * Get the value of the accumulator for a given node
33 *
34 * @param node the node in question
35 * @param postDescent false if the pre-descent value of the accumulator is required;
36 * false if the post-descent value is wanted.
37 * @return the value of the accumulator for this node
38 */
39
40 public Sequence<?> getValue(NodeInfo node, boolean postDescent) throws XPathException {
41 NodeInfo original = ((VirtualCopy)node).getOriginalNode();
42 return realData.getValue(original, postDescent);
43 }
44
45
46 }