Package net.sf.saxon.functions
Class RegexFunction
java.lang.Object
net.sf.saxon.functions.AbstractFunction
net.sf.saxon.functions.SystemFunction
net.sf.saxon.functions.RegexFunction
- All Implemented Interfaces:
Callable
,StatefulSystemFunction
,FunctionItem
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
AnalyzeStringFn
,Matches
,Replace
,ReplaceWith
,Tokenize_3
This class implements any of the functions matches(), replace(), tokenize(), analyze-string(), in the
version where a flags argument is present in the argument list
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
copy()
Make a copy of this SystemFunction.protected RegularExpression
getRegularExpression
(Sequence[] args, int regexPos, int flagsPos) Get the regular expression at evaluation timemakeFunctionCall
(Expression... arguments) Make an expression that either calls this function, or that is equivalent to a call on this functionmakeOptimizedFunctionCall
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments) Allow the function to create an optimized call based on the values of the actual argumentsMethods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getContextNode, getDescription, getDetails, getElaborator, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeFunction40, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEqual40, deepEquals, effectiveBooleanValue, getAnnotations, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.saxon.om.FunctionItem
getGenre
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
RegexFunction
public RegexFunction()
-
-
Method Details
-
getStaticRegex
-
copy
Make a copy of this SystemFunction. This is required only for system functions such as regex functions that maintain state on behalf of a particular caller.- Specified by:
copy
in interfaceStatefulSystemFunction
- Returns:
- a copy of the system function able to contain its own copy of the state on behalf of the caller.
-
allowRegexMatchingEmptyString
protected abstract boolean allowRegexMatchingEmptyString() -
makeFunctionCall
Make an expression that either calls this function, or that is equivalent to a call on this function- Overrides:
makeFunctionCall
in classSystemFunction
- Parameters:
arguments
- the supplied arguments to the function call- Returns:
- either a function call on this function, or an expression that delivers the same result
-
makeOptimizedFunctionCall
public Expression makeOptimizedFunctionCall(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments) throws XPathException Allow the function to create an optimized call based on the values of the actual arguments- Overrides:
makeOptimizedFunctionCall
in classSystemFunction
- Parameters:
visitor
- the expression visitorcontextInfo
- information about the context itemarguments
- the supplied arguments to the function call. Note: modifying the contents of this array should not be attempted, it is likely to have no effect.- Returns:
- either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
- Throws:
XPathException
- if an error is detected
-
getRegularExpression
protected RegularExpression getRegularExpression(Sequence[] args, int regexPos, int flagsPos) throws XPathException Get the regular expression at evaluation time- Parameters:
args
- the argument values in the function call- Returns:
- the compiled regular expression; either the expression pre-compiled statically, or the result of compiling it dynamically. The XPath 4.0 tokenize() function allows the argument to be an empty sequence; in this case return null.
- Throws:
XPathException
- if the regular expression is invalid
-