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
,Function
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
AnalyzeStringFn
,Matches
,Replace
,ReplaceWith
,Tokenize_3
public abstract class RegexFunction extends SystemFunction implements StatefulSystemFunction
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 Constructor Description RegexFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
allowRegexMatchingEmptyString()
RegexFunction
copy()
Make a copy of this SystemFunction.protected RegularExpression
getRegularExpression(Sequence[] args)
Get the regular expression at evaluation timeRegularExpression
getStaticRegex()
Expression
makeFunctionCall(Expression... arguments)
Make an expression that either calls this function, or that is equivalent to a call on this functionExpression
makeOptimizedFunctionCall(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments)
Allow the function to create an optimized call based on the values of the actual arguments-
Methods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
-
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getSerialNumber, 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.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
-
-
-
-
Method Detail
-
getStaticRegex
public RegularExpression getStaticRegex()
-
copy
public RegexFunction 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
public Expression makeFunctionCall(Expression... arguments)
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) 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
- Throws:
XPathException
- if the regular expression is invalid
-
-