Package net.sf.saxon.functions
Class SystemFunction
- java.lang.Object
-
- net.sf.saxon.expr.ComputedExpression
-
- net.sf.saxon.expr.FunctionCall
-
- net.sf.saxon.functions.SystemFunction
-
- All Implemented Interfaces:
java.io.Serializable
,javax.xml.transform.SourceLocator
,Container
,Expression
,InstructionInfoProvider
- Direct Known Subclasses:
Adjust
,Aggregate
,Available
,BaseURI
,BooleanFn
,CodepointEqual
,CollatingFunction
,Collection
,CompileTimeFunction
,Component
,Concat
,Current
,CurrentDateTime
,CurrentGroup
,DateTimeConstructor
,Doc
,Document
,Error
,EscapeURI
,Evaluate
,Existence
,ForceCase
,FormatDate
,FormatNumber2
,Id
,Idref
,InScopePrefixes
,Insert
,KeyFn
,Lang
,Last
,Matches
,NamePart
,NamespaceForPrefix
,Nilled
,NormalizeSpace
,NormalizeUnicode
,NumberFn
,Parse
,Position
,QNameFn
,RegexGroup
,Remove
,Replace
,ResolveQName
,ResolveURI
,Root
,Rounding
,Serialize
,StringFn
,StringJoin
,StringLength
,Subsequence
,Substring
,SystemProperty
,Tokenize
,Trace
,Translate
,TreatFn
,Unicode
,UnparsedEntity
,UnparsedText
public abstract class SystemFunction extends FunctionCall
Abstract superclass for system-defined and user-defined functions- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
operation
-
Fields inherited from class net.sf.saxon.expr.FunctionCall
argument
-
Fields inherited from class net.sf.saxon.expr.ComputedExpression
locationId, staticProperties
-
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
-
-
Constructor Summary
Constructors Constructor Description SystemFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addContextDocumentArgument(int pos, java.lang.String augmentedName)
Add an implicit argument referring to the context document.void
checkArguments(StaticContext env)
Method called during static type checkingint
computeCardinality()
Determine the cardinality of the function.int
computeSpecialProperties()
Determine the special properties of this expression.void
display(int level, java.io.PrintStream out, Configuration config)
Diagnostic print of expression structureStandardFunction.Entry
getDetails()
Get the detailsjava.lang.String
getErrorCodeForTypeErrors()
Return the error code to be used for type errors.ItemType
getItemType(TypeHierarchy th)
Determine the item type of the value returned by the functionprotected SequenceType
getRequiredType(int arg)
Get the required type of the nth argumentstatic void
main(java.lang.String[] args)
The main() method of this class is not intended to be called, it merely tells the code inspection tools in IDEA that the constructors of each function class are actual entry pointsstatic FunctionCall
makeSystemFunction(java.lang.String name, int arity, NamePool pool)
Make a system function (one in the standard function namespace).void
setDetails(StandardFunction.Entry entry)
Set the details of this type of functionprotected void
useContextItemAsDefault()
Set "." as the default value for the first and only argument.-
Methods inherited from class net.sf.saxon.expr.FunctionCall
checkArgumentCount, getArguments, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, optimize, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionNameCode, simplify, simplifyArguments, typeCheck
-
Methods inherited from class net.sf.saxon.expr.ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, iterate, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeError
-
-
-
-
Method Detail
-
makeSystemFunction
public static FunctionCall makeSystemFunction(java.lang.String name, int arity, NamePool pool)
Make a system function (one in the standard function namespace).- Parameters:
name
- The local name of the function. It may also be a lexical QName for a recognized built-in function, e.g. saxon:evaluate, in which case the prefix is hard-coded.- Returns:
- a FunctionCall that implements this function, if it exists, or null if the function is unknown.
-
setDetails
public void setDetails(StandardFunction.Entry entry)
Set the details of this type of function
-
getDetails
public StandardFunction.Entry getDetails()
Get the details
-
checkArguments
public void checkArguments(StaticContext env) throws XPathException
Method called during static type checking- Specified by:
checkArguments
in classFunctionCall
- Throws:
XPathException
-
getErrorCodeForTypeErrors
public java.lang.String getErrorCodeForTypeErrors()
Return the error code to be used for type errors. This is overridden for functions such as exactly-one(), one-or-more(), ...
-
getRequiredType
protected SequenceType getRequiredType(int arg)
Get the required type of the nth argument
-
getItemType
public ItemType getItemType(TypeHierarchy th)
Determine the item type of the value returned by the function- Parameters:
th
-- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
-
computeCardinality
public int computeCardinality()
Determine the cardinality of the function.- Specified by:
computeCardinality
in classComputedExpression
-
computeSpecialProperties
public int computeSpecialProperties()
Determine the special properties of this expression. The general rule is that a system function call is non-creative if its return type is atomic, or if all its arguments are non-creative. This is overridden for the generate-id() function, which is considered creative if its operand is creative (because the result depends on the identity of the operand)- Overrides:
computeSpecialProperties
in classComputedExpression
-
useContextItemAsDefault
protected final void useContextItemAsDefault()
Set "." as the default value for the first and only argument. Called from subclasses.
-
addContextDocumentArgument
protected final void addContextDocumentArgument(int pos, java.lang.String augmentedName) throws StaticError
Add an implicit argument referring to the context document. Called by functions such as id() and key() that take the context document as an implicit argument- Throws:
StaticError
-
display
public void display(int level, java.io.PrintStream out, Configuration config)
Diagnostic print of expression structure- Specified by:
display
in interfaceExpression
- Overrides:
display
in classFunctionCall
- Parameters:
level
- indentation level for this expressionout
- Output destination
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
The main() method of this class is not intended to be called, it merely tells the code inspection tools in IDEA that the constructors of each function class are actual entry points- Throws:
java.lang.Exception
-
-