Debian Codegraph @

net/sf/saxon/type/FunctionItemType.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.type;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.parser.RoleDiagnostic;
12 import net.sf.saxon.om.Genre;
13 import net.sf.saxon.query.AnnotationList;
14 import net.sf.saxon.trans.XPathException;
15 import net.sf.saxon.value.SequenceType;
16
17 /**
18 * Higher-order functions in XPath 3.0 introduce a third kind of Item, namely a Function Item.
19 * This type is represented here by a placeholder interfaces. The implementation of this type
20 * is found only in Saxon-EE
21 */
22
23 public interface FunctionItemType extends ItemType {
24
25 /**
26 * Determine the Genre (top-level classification) of this type
27 *
28 * @return the Genre to which this type belongs, specifically {@link Genre#FUNCTION}
29 */
30 @Override
31 default Genre getGenre() {
32 return Genre.FUNCTION;
33 }
34
35 /**
36 * Get the argument types of the function
37 *
38 * @return the argument types, as an array of SequenceTypes; or null if this is the generic function type
39 * function(*)
40 */
41
42 /*@Nullable*/
43 SequenceType[] getArgumentTypes();
44
45 /**
46 * Get the result type of the function
47 *
48 * @return the result type, as a SequenceType
49 */
50
51 SequenceType getResultType();
52
53 /**
54 * Determine the relationship of one function item type to another. This method is only concerned
55 * with the type signatures of the two function item types, and not with their annotation assertions.
56 *
57 * @return for example {@link TypeHierarchy#SUBSUMES}, {@link TypeHierarchy#SAME_TYPE}
58 */
59
60 int relationship(FunctionItemType other, TypeHierarchy th);
61
62 /**
63 * Get the list of Annotation Assertions associated with this function item type
64 * @return the list of annotation assertions
65 */
66
67 AnnotationList getAnnotationAssertions();
68
69 /**
70 * Create an expression whose effect is to apply function coercion to coerce a function to this function type
71 *
72 * @param exp the expression that delivers the supplied sequence of function items (the ones in need of coercion)
73 * @param role information for use in diagnostics
74 * @return the coerced function, a function that calls the original function after checking the parameters
75 */
76
77 Expression makeFunctionSequenceCoercer(Expression exp, RoleDiagnostic role)
78 throws XPathException;
79
80 /**
81 * Ask whether this function item type is a map type. In this case function coercion (to the map type)
82 * will never succeed.
83 *
84 * @return true if this FunctionItemType is a map type
85 */
86
87 boolean isMapType();
88
89 /**
90 * Ask whether this function item type is an array type. In this case function coercion (to the array type)
91 * will never succeed.
92 *
93 * @return true if this FunctionItemType is an array type
94 */
95
96 boolean isArrayType();
97 }
98