Package net.sf.saxon.expr.instruct
Class UserFunctionParameter
- java.lang.Object
-
- net.sf.saxon.expr.instruct.UserFunctionParameter
-
- All Implemented Interfaces:
java.io.Serializable,Binding
public class UserFunctionParameter extends java.lang.Object implements Binding, java.io.Serializable
Run-time object representing a formal argument to a user-defined function- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UserFunctionParameter()Create a UserFunctionParameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReference(boolean isLoopingReference)Register a variable reference that refers to the variable bound in this expressionValueRepresentationevaluateVariable(XPathContext context)Evaluate this function parameterIntegerValue[]getIntegerBoundsForVariable()If the variable is bound to an integer, get the minimum and maximum possible values.intgetLocalSlotNumber()If this is a local variable held on the local stack frame, return the corresponding slot number.intgetReferenceCount()Get the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple referencesSequenceTypegetRequiredType()Get the required type of this function parameterStructuredQNamegetVariableQName()Get the name of this parameterbooleanisAssignable()Test whether it is permitted to assign to the variable using the saxon:assign extension element.booleanisGlobal()Indicate whether the binding is local or global.booleanisIndexedVariable()Ask whether this parameter requires support for indexingvoidsetIndexedVariable(boolean indexed)Indicate that this parameter requires (or does not require) support for indexingvoidsetReferenceCount(int count)Set the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple referencesvoidsetRequiredType(SequenceType type)Set the required type of this function parametervoidsetSlotNumber(int slot)Set the slot number to be used by this parametervoidsetVariableQName(StructuredQName name)Set the name of this parameter
-
-
-
Method Detail
-
isGlobal
public final boolean isGlobal()
Indicate whether the binding is local or global. A global binding is one that has a fixed value for the life of a query or transformation; any other binding is local.
-
isAssignable
public final boolean isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element. This will only be for an XSLT global variable where the extra attribute saxon:assignable="yes" is present.- Specified by:
isAssignablein interfaceBinding- Returns:
- false (always)
-
setSlotNumber
public void setSlotNumber(int slot)
Set the slot number to be used by this parameter- Parameters:
slot- the slot number, that is, the position of the parameter value within the local stack frame
-
getLocalSlotNumber
public int getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number. In other cases, return -1.- Specified by:
getLocalSlotNumberin interfaceBinding- Returns:
- the slot number, indicating the position of the parameter on the local stack frame
-
setRequiredType
public void setRequiredType(SequenceType type)
Set the required type of this function parameter- Parameters:
type- the declared type of the parameter
-
getRequiredType
public SequenceType getRequiredType()
Get the required type of this function parameter- Specified by:
getRequiredTypein interfaceBinding- Returns:
- the declared type of the parameter
-
getIntegerBoundsForVariable
public IntegerValue[] getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values. Return null if unknown or not applicable- Specified by:
getIntegerBoundsForVariablein interfaceBinding- Returns:
- a pair of integers containing the minimum and maximum values for the integer value; or null if the value is not an integer or the range is unknown
-
setVariableQName
public void setVariableQName(StructuredQName name)
Set the name of this parameter- Parameters:
name- the name of the parameter
-
getVariableQName
public StructuredQName getVariableQName()
Get the name of this parameter- Specified by:
getVariableQNamein interfaceBinding- Returns:
- the name of this parameter
-
addReference
public void addReference(boolean isLoopingReference)
Description copied from interface:BindingRegister a variable reference that refers to the variable bound in this expression- Specified by:
addReferencein interfaceBinding- Parameters:
isLoopingReference- - true if the reference occurs within a loop, such as the predicate of a filter expression
-
setReferenceCount
public void setReferenceCount(int count)
Set the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple references- Parameters:
count- the nominal number of references
-
getReferenceCount
public int getReferenceCount()
Get the (nominal) number of references within the function body to this parameter, where a reference inside a loop is counted as multiple references- Returns:
- the nominal number of references
-
setIndexedVariable
public void setIndexedVariable(boolean indexed)
Indicate that this parameter requires (or does not require) support for indexing- Parameters:
indexed- true if support for indexing is required. This will be set if the parameter is used in a filter expression such as $param[@a = 17]
-
isIndexedVariable
public boolean isIndexedVariable()
Ask whether this parameter requires support for indexing- Returns:
- true if support for indexing is required. This will be set if the parameter is used in a filter expression such as $param[@a = 17]
-
evaluateVariable
public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException
Evaluate this function parameter- Specified by:
evaluateVariablein interfaceBinding- Parameters:
context- the XPath dynamic context- Returns:
- the value of the parameter
- Throws:
XPathException- if an error occurs
-
-