net.sf.saxon.expr.instruct
Class WithParam

java.lang.Object
  extended by net.sf.saxon.expr.instruct.GeneralVariable
      extended by net.sf.saxon.expr.instruct.WithParam
All Implemented Interfaces:
SourceLocator, Binding

public class WithParam
extends GeneralVariable

An object derived from a xsl:with-param element in the stylesheet.


Field Summary
static WithParam[] EMPTY_ARRAY
           
 
Fields inherited from class net.sf.saxon.expr.instruct.GeneralVariable
evaluationMode, referenceCount, slotNumber, variableQName
 
Constructor Summary
WithParam()
           
 
Method Summary
static WithParam[] copy(WithParam[] params)
          Static method to copy a set of parameters
 ValueRepresentation evaluateVariable(XPathContext context)
          Evaluate the variable (method exists only to satisfy the interface)
static void explainParameters(WithParam[] params, ExpressionPresenter out)
          Static method to explain a set of parameters
static void gatherXPathExpressions(WithParam[] params, List<Expression> list)
          Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)
 int getInstructionNameCode()
          Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnostics
 int getParameterId()
          Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheet
 boolean isTypeChecked()
          Ask whether static type checking has been done
static void optimize(ExpressionVisitor visitor, WithParam[] params, ExpressionVisitor.ContextItemType contextItemType)
          Static method to optimize a set of with-param elements
static void promoteParams(Expression parent, WithParam[] params, PromotionOffer offer)
          Static method to do expression promotion on a set of with-param elements
static boolean replaceXPathExpression(WithParam[] params, Expression original, Expression replacement)
          Static method to replace a subexpression within any parameter within which it is found
 void setParameterId(int id)
          Allocate a number which is essentially an alias for the parameter name, unique within a stylesheet
 void setTypeChecked(boolean checked)
          Say whether this parameter will have been typechecked by the caller to ensure it satisfies the required type, in which case the callee need not do a dynamic type check
static void simplify(WithParam[] params, ExpressionVisitor visitor)
          Static method to simplify a set of with-param elements
static void typeCheck(WithParam[] params, ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)
          Static method to typecheck a set of with-param elements
 
Methods inherited from class net.sf.saxon.expr.instruct.GeneralVariable
addReference, checkAgainstRequiredType, computeEvaluationMode, copy, explain, getCardinality, getColumnNumber, getContainer, getEvaluationMode, getExecutable, getIntegerBoundsForVariable, getLineNumber, getLocalSlotNumber, getLocationId, getLocationProvider, getPublicId, getRequiredType, getSelectExpression, getSelectValue, getSlotNumber, getSystemId, getSystemId, getVariableQName, init, isAssignable, isGlobal, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterateSubExpressions, optimize, replaceSubExpression, setAssignable, setContainer, setImplicitlyRequiredParam, setLocationId, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableQName, simplify, typeCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static WithParam[] EMPTY_ARRAY
Constructor Detail

WithParam

public WithParam()
Method Detail

setParameterId

public void setParameterId(int id)
Allocate a number which is essentially an alias for the parameter name, unique within a stylesheet

Parameters:
id - the parameter id

setTypeChecked

public void setTypeChecked(boolean checked)
Say whether this parameter will have been typechecked by the caller to ensure it satisfies the required type, in which case the callee need not do a dynamic type check

Parameters:
checked - true if the caller has done static type checking against the required type

getParameterId

public int getParameterId()
Get the parameter id, which is essentially an alias for the parameter name, unique within a stylesheet

Returns:
the parameter id

getInstructionNameCode

public int getInstructionNameCode()
Description copied from class: GeneralVariable
Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnostics

Overrides:
getInstructionNameCode in class GeneralVariable
Returns:
the name of this instruction, as a name pool name code

simplify

public static void simplify(WithParam[] params,
                            ExpressionVisitor visitor)
                     throws XPathException
Static method to simplify a set of with-param elements

Parameters:
params - the set of parameters to be simplified
visitor - the expression visitor
Throws:
XPathException - if a static error is found

typeCheck

public static void typeCheck(WithParam[] params,
                             ExpressionVisitor visitor,
                             ExpressionVisitor.ContextItemType contextItemType)
                      throws XPathException
Static method to typecheck a set of with-param elements

Parameters:
params - the set of parameters to be checked
visitor - the expression visitor
contextItemType - static information about the context item type and existence
Throws:
XPathException - if a static error is found

optimize

public static void optimize(ExpressionVisitor visitor,
                            WithParam[] params,
                            ExpressionVisitor.ContextItemType contextItemType)
                     throws XPathException
Static method to optimize a set of with-param elements

Parameters:
params - the set of parameters to be optimized
visitor - the expression visitor
contextItemType - static information about the context item type and existence
Throws:
XPathException - if a static error is found

promoteParams

public static void promoteParams(Expression parent,
                                 WithParam[] params,
                                 PromotionOffer offer)
                          throws XPathException
Static method to do expression promotion on a set of with-param elements

Parameters:
parent - the parent instruction (for example apply-templates or call-template)
params - the set of parameters to be be investigated for promotion
offer - the promotion offer to be passed to subexpressions
Throws:
XPathException - if a static error is found

copy

public static WithParam[] copy(WithParam[] params)
Static method to copy a set of parameters

Parameters:
params - the parameters to be copied
Returns:
the resulting copy

gatherXPathExpressions

public static void gatherXPathExpressions(WithParam[] params,
                                          List<Expression> list)
Static method to gather the XPath expressions used in an array of WithParam parameters (add them to the supplied list)

Parameters:
params - the set of with-param elements to be searched
list - the list to which the subexpressions will be added

explainParameters

public static void explainParameters(WithParam[] params,
                                     ExpressionPresenter out)
Static method to explain a set of parameters

Parameters:
params - the set of parameters to be explained
out - the destination for the explanation

replaceXPathExpression

public static boolean replaceXPathExpression(WithParam[] params,
                                             Expression original,
                                             Expression replacement)
Static method to replace a subexpression within any parameter within which it is found

Parameters:
params - the set of parameters to be examined
original - the subexpression to be replaced
replacement - the replacement expression
Returns:
true if a replacement was made

evaluateVariable

public ValueRepresentation evaluateVariable(XPathContext context)
                                     throws XPathException
Evaluate the variable (method exists only to satisfy the interface)

Parameters:
context - the XPath dynamic evaluation context
Returns:
the result of evaluating the variable
Throws:
XPathException - if an error occurs while evaluating the variable

isTypeChecked

public boolean isTypeChecked()
Ask whether static type checking has been done

Returns:
true if the caller has done static type checking against the type required by the callee


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.