Debian Codegraph @

net/sf/saxon/expr/sort/ItemWithMergeKeys.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.sort;
9
10 import net.sf.saxon.expr.XPathContext;
11 import net.sf.saxon.om.Item;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.value.AtomicValue;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 /**
19 * A class representing an item together with its merge keys and the name of the merge source object
20 * from which it derived, suitable for encapsulation as an ObjectValue.
21 * The input sequences are mapped to sequences of these items, and the merge keys are then stripped off
22 * before applying the merge action.
23 */
24
25 public class ItemWithMergeKeys {
26 Item baseItem;
27 List<AtomicValue> sortKeyValues;
28 String sourceName;
29
30 /**
31 * Create an item, calculate with its merge keys, and construct the composite item in which
32 * the merge key values are saved
33 *
34 * @param bItem the item to be encapsulated
35 * @param sKeys the merge key definitions
36 * @param name the merge source name
37 * @param context the dynamic context, used for evaluating the merge keys for the item
38 * @throws net.sf.saxon.trans.XPathException if evaluation of a sort key fails
39 */
40
41 ItemWithMergeKeys(Item bItem, SortKeyDefinitionList sKeys, String name, XPathContext context) throws XPathException {
42 baseItem = bItem;
43 sourceName = name;
44 sortKeyValues = new ArrayList<AtomicValue>(sKeys.size());
45
46 for (SortKeyDefinition sKey : sKeys) {
47 sortKeyValues.add((AtomicValue) sKey.getSortKey().evaluateItem(context));
48 }
49
50 }
51 }
52
53