Debian Codegraph @

net/sf/saxon/expr/Callable.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;
9
10 import net.sf.saxon.om.Item;
11 import net.sf.saxon.om.Sequence;
12 import net.sf.saxon.trans.XPathException;
13
14 /**
15 * A generic interface for calling expressions by supplying the values of their subexpressions
16 */
17
18 public interface Callable {
19
20 /**
21 * Call the Callable.
22 *
23 *
24 * @param context the dynamic evaluation context
25 * @param arguments the values of the arguments, supplied as Sequences.
26 * <p>Generally it is advisable, if calling iterate() to process a supplied sequence, to
27 * call it only once; if the value is required more than once, it should first be converted
28 * to a {@link net.sf.saxon.om.GroundedValue} by calling the utility method
29 * SequenceTool.toGroundedValue().</p>
30 * <p>If the expected value is a single item, the item should be obtained by calling
31 * Sequence.head(): it cannot be assumed that the item will be passed as an instance of
32 * {@link net.sf.saxon.om.Item} or {@link net.sf.saxon.value.AtomicValue}.</p>
33 * <p>It is the caller's responsibility to perform any type conversions required
34 * to convert arguments to the type expected by the callee. An exception is where
35 * this Callable is explicitly an argument-converting wrapper around the original
36 * Callable.</p>
37 * @return the result of the evaluation, in the form of a Sequence. It is the responsibility
38 * of the callee to ensure that the type of result conforms to the expected result type.
39 * @throws XPathException if a dynamic error occurs during the evaluation of the expression
40 */
41
42 /*@Nullable*/
43 Sequence<?> call(XPathContext context, Sequence<?>[] arguments) throws XPathException;
44
45 }