Package net.sf.saxon.functions
Class Translate
java.lang.Object
net.sf.saxon.functions.AbstractFunction
net.sf.saxon.functions.SystemFunction
net.sf.saxon.functions.Translate
- All Implemented Interfaces:
Callable
,StatefulSystemFunction
,Function
,GroundedValue
,Item
,Sequence
Implement the XPath translate() function
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall
(XPathContext context, Sequence[] arguments) Evaluate the expressioncopy()
Make a copy of this SystemFunction.fixArguments
(Expression... arguments) Allow the function to create an optimized call based on the values of the actual argumentsGet the (local) name of a class that can be used to generate bytecode for this system functionGet the translation map built at compile time if there is onestatic CharSequence
translate
(StringValue sv0, StringValue sv1, StringValue sv2) Perform the translate functionstatic CharSequence
translateUsingMap
(StringValue in, IntToIntMap map) Implement the translate() function using an index built at compile timeMethods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, getArity, getCardinality, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, importAttributes, isTrustedResultType, makeCall, makeFunction, makeFunctionCall, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getStringValue, getStringValueCS, isArray, isMap, makeNewContext, simplify, typeCheck
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, 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, head, isStreamed, itemAt, iterate, reduce, subsequence
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
Translate
public Translate()
-
-
Method Details
-
fixArguments
Allow the function to create an optimized call based on the values of the actual arguments- Overrides:
fixArguments
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, or null indicating that no optimization has taken place
-
getStaticMap
Get the translation map built at compile time if there is one- Returns:
- the map built at compile time, or null if not available
-
translate
Perform the translate function- Parameters:
sv0
- the string to be translatedsv1
- the characters to be substitutedsv2
- the replacement characters- Returns:
- the converted string
-
translateUsingMap
Implement the translate() function using an index built at compile time- Parameters:
in
- the string to be translatedmap
- index built at compile time, mapping input characters to output characters. The map returns -1 for a character that is to be deleted from the input string, Integer.MAX_VALUE for a character that is to remain intact- Returns:
- the translated character string
-
call
Evaluate the expression- Specified by:
call
in interfaceCallable
- Specified by:
call
in interfaceFunction
- Parameters:
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as Sequences- Returns:
- the result of the evaluation, in the form of a Sequence
- Throws:
XPathException
- if a dynamic error occurs during the evaluation of the expression
-
getCompilerName
Description copied from class:SystemFunction
Get the (local) name of a class that can be used to generate bytecode for this system function- Overrides:
getCompilerName
in classSystemFunction
- Returns:
- the name of a bytecode generation class, or null if there is no bytecode support for this function
-
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.
-