Package net.sf.saxon.type
Class SpecificFunctionType
- java.lang.Object
-
- net.sf.saxon.type.AnyFunctionType
-
- net.sf.saxon.type.SpecificFunctionType
-
- All Implemented Interfaces:
FunctionItemType
,ItemType
public class SpecificFunctionType extends AnyFunctionType
An instance of this class represents a specific function item type, for example function(xs:int) as xs:boolean
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sf.saxon.type.ItemType
ItemType.WithSequenceTypeCache
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.type.AnyFunctionType
ANY_FUNCTION
-
-
Constructor Summary
Constructors Constructor Description SpecificFunctionType(SequenceType[] argTypes, SequenceType resultType)
SpecificFunctionType(SequenceType[] argTypes, SequenceType resultType, AnnotationList annotations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Test whether this function type equals another function typejava.util.Optional<java.lang.String>
explainMismatch(Item item, TypeHierarchy th)
Get extra diagnostic information about why a supplied item does not conform to this item type, if available.AnnotationList
getAnnotationAssertions()
Get the list of annotation assertions defined on this function item type.SequenceType[]
getArgumentTypes()
Get the argument typesint
getArity()
Get the arity (number of arguments) of this function typedouble
getDefaultPriority()
Get the default priority when this ItemType is used as an XSLT patternSequenceType
getResultType()
Get the result typeint
hashCode()
Returns a hash code value for the object.boolean
isAtomizable(TypeHierarchy th)
Ask whether values of this type are atomizableExpression
makeFunctionSequenceCoercer(Expression exp, RoleDiagnostic role)
Create an expression whose effect is to apply function coercion to coerce a function from this type to another typeboolean
matches(Item item, TypeHierarchy th)
Test whether a given item conforms to this typeAffinity
relationship(FunctionItemType other, TypeHierarchy th)
Determine the relationship of one function item type to another.java.lang.String
toExportString()
Return a string representation of this ItemType suitable for use in stylesheet export files.java.lang.String
toString()
Produce a representation of this type name for use in error messages.-
Methods inherited from class net.sf.saxon.type.AnyFunctionType
getAtomizedItemType, getBasicAlphaCode, getInstance, getPrimitiveItemType, getPrimitiveType, getUType, isArrayType, isAtomicType, isMapType, isPlainType
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.type.FunctionItemType
getGenre
-
Methods inherited from interface net.sf.saxon.type.ItemType
getFullAlphaCode, getNormalizedDefaultPriority, isTrueItemType
-
-
-
-
Constructor Detail
-
SpecificFunctionType
public SpecificFunctionType(SequenceType[] argTypes, SequenceType resultType)
-
SpecificFunctionType
public SpecificFunctionType(SequenceType[] argTypes, SequenceType resultType, AnnotationList annotations)
-
-
Method Detail
-
getArity
public int getArity()
Get the arity (number of arguments) of this function type- Returns:
- the number of argument types in the function signature
-
getArgumentTypes
public SequenceType[] getArgumentTypes()
Get the argument types- Specified by:
getArgumentTypes
in interfaceFunctionItemType
- Overrides:
getArgumentTypes
in classAnyFunctionType
- Returns:
- the list of argument types
-
getResultType
public SequenceType getResultType()
Get the result type- Specified by:
getResultType
in interfaceFunctionItemType
- Overrides:
getResultType
in classAnyFunctionType
- Returns:
- the result type
-
getAnnotationAssertions
public AnnotationList getAnnotationAssertions()
Get the list of annotation assertions defined on this function item type.- Specified by:
getAnnotationAssertions
in interfaceFunctionItemType
- Overrides:
getAnnotationAssertions
in classAnyFunctionType
- Returns:
- the list of annotation assertions, or an empty list if there are none
-
isAtomizable
public boolean isAtomizable(TypeHierarchy th)
Ask whether values of this type are atomizable- Specified by:
isAtomizable
in interfaceItemType
- Overrides:
isAtomizable
in classAnyFunctionType
- Parameters:
th
- The type hierarchy cache- Returns:
- true if some or all instances of this type can be successfully atomized; false * if no instances of this type can be atomized
-
toString
public java.lang.String toString()
Produce a representation of this type name for use in error messages.- Specified by:
toString
in interfaceItemType
- Overrides:
toString
in classAnyFunctionType
- Returns:
- a string representation of the type, in notation resembling but not necessarily identical to XPath syntax
-
toExportString
public java.lang.String toExportString()
Description copied from interface:ItemType
Return a string representation of this ItemType suitable for use in stylesheet export files. This differs from the result of toString() in that it will not contain any references to anonymous types. Note that it may also use the Saxon extended syntax for union types and tuple types. The default implementation returns the result of callingtoString()
.- Returns:
- the string representation as an instance of the XPath SequenceType construct
-
equals
public boolean equals(java.lang.Object other)
Test whether this function type equals another function type- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
-
relationship
public Affinity relationship(FunctionItemType other, TypeHierarchy th)
Determine the relationship of one function item type to another. This method is only concerned with the type signatures of the two function item types, and not with their annotation assertions.- Specified by:
relationship
in interfaceFunctionItemType
- Overrides:
relationship
in classAnyFunctionType
- Returns:
- for example
Affinity.SUBSUMES
,Affinity.SAME_TYPE
-
getDefaultPriority
public double getDefaultPriority()
Get the default priority when this ItemType is used as an XSLT pattern- Specified by:
getDefaultPriority
in interfaceItemType
- Overrides:
getDefaultPriority
in classAnyFunctionType
- Returns:
- the default priority
-
matches
public boolean matches(Item item, TypeHierarchy th)
Test whether a given item conforms to this type- Specified by:
matches
in interfaceItemType
- Overrides:
matches
in classAnyFunctionType
- Parameters:
item
- The item to be testedth
- the type hierarchy cache- Returns:
- true if the item is an instance of this type; false otherwise
-
explainMismatch
public java.util.Optional<java.lang.String> explainMismatch(Item item, TypeHierarchy th)
Get extra diagnostic information about why a supplied item does not conform to this item type, if available. If extra information is returned, it should be in the form of a complete sentence, minus the closing full stop. No information should be returned for obvious cases.- Parameters:
item
- the item that doesn't match this typeth
- the type hierarchy cache- Returns:
- optionally, a message explaining why the item does not match the type
-
makeFunctionSequenceCoercer
public Expression makeFunctionSequenceCoercer(Expression exp, RoleDiagnostic role) throws XPathException
Description copied from class:AnyFunctionType
Create an expression whose effect is to apply function coercion to coerce a function from this type to another type- Specified by:
makeFunctionSequenceCoercer
in interfaceFunctionItemType
- Overrides:
makeFunctionSequenceCoercer
in classAnyFunctionType
- Parameters:
exp
- the expression that delivers the supplied sequence of function items (the ones in need of coercion)role
- information for use in diagnostics- Returns:
- the sequence of coerced functions, each on a function that calls the corresponding original function after checking the parameters
- Throws:
XPathException
-
-