Package net.sf.saxon.expr.instruct
Class SlotManager
java.lang.Object
net.sf.saxon.expr.instruct.SlotManager
- Direct Known Subclasses:
SlotManagerEE
A SlotManager supports functions, templates, etc: specifically, any executable code that
requires a stack frame containing local variables. In XSLT a SlotManager underpins any
top-level element that can contain local variable declarations,
specifically, a top-level xsl:template, xsl:variable, xsl:param, or xsl:function element
or an xsl:attribute-set element or xsl:key element. In XQuery it underpins functions and
global variables. The purpose of the SlotManager is to allocate slot numbers to variables
in the stack, and to record how many slots are needed. A Debugger may define a subclass
with additional functionality.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor should not be called directly.SlotManager
(int n) Create a SlotManager with a given number of slots -
Method Summary
Modifier and TypeMethodDescriptionint
allocateSlotNumber
(StructuredQName qName, LocalBinding binding) Allocate a slot number for a variableint
Get number of variables (size of stack frame)Get the variable map (simply a list of variable names as structured QNames).void
setNumberOfVariables
(int numberOfVariables) Set the number of variablesvoid
showStackFrame
(XPathContext context, Logger logger) Display the values of the variables and parameters in an XPathContext stack frame to a Logger
-
Field Details
-
EMPTY
An empty SlotManager
-
-
Constructor Details
-
SlotManager
public SlotManager()The constructor should not be called directly. A new SlotManager should be obtained using the factory methodConfiguration.makeSlotManager()
. -
SlotManager
public SlotManager(int n) Create a SlotManager with a given number of slots- Parameters:
n
- the number of slots
-
-
Method Details
-
getNumberOfVariables
public int getNumberOfVariables()Get number of variables (size of stack frame)- Returns:
- the number of slots for variables
-
setNumberOfVariables
public void setNumberOfVariables(int numberOfVariables) Set the number of variables- Parameters:
numberOfVariables
- the space to be allocated for variables
-
allocateSlotNumber
Allocate a slot number for a variable- Parameters:
qName
- the name of the variablebinding
- the binding of the variable (only used in Saxon-EE)- Returns:
- the allocated slot number (the next one available)
-
getVariableMap
Get the variable map (simply a list of variable names as structured QNames). Note that it is possible for several variables to have the same name.- Returns:
- the list of variable names for this stack frame
-
showStackFrame
Display the values of the variables and parameters in an XPathContext stack frame to a Logger- Parameters:
context
- the XPathContext holding the stack framelogger
- the destination for the output
-