Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.expr.instruct
Class SlotManager

    java.lang.Object
      net.sf.saxon.expr.instruct.SlotManager

All Implemented Interfaces:
  Serializable

    public class SlotManager

extends Object
implements Serializable

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.

See Also:
  Serialized Form

Field Summary
`static SlotManager` | `EMPTY` An empty SlotManager

Constructor Summary
`SlotManager()` The constructor should not be called directly.
`SlotManager(int n)` Create a SlotManager with a given number of slots

Method Summary
`int` | `allocateSlotNumber(StructuredQName qName)` Allocate a slot number for a variable
`int` | `getNumberOfVariables()` Get number of variables (size of stack frame)
`List<StructuredQName>` | `getVariableMap()` Get the variable map (simply a list of variable names as structured QNames).
`void` | `setNumberOfVariables(int numberOfVariables)` Set the number of variables

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY

    public static SlotManager EMPTY

  An empty SlotManager

Constructor Detail

### SlotManager

    public SlotManager()

  The constructor should not be called directly. A new SlotManager should be obtained using the factory method `Configuration.makeSlotManager()`.

### SlotManager

    public SlotManager(int n)

  Create a SlotManager with a given number of slots

  Parameters:
    `n` - the number of slots

Method Detail

### 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

    public int allocateSlotNumber(StructuredQName qName)

  Allocate a slot number for a variable

  Parameters:
    `qName` - the name of the variable
  Returns:
    the allocated slot number (the next one available)

### getVariableMap

    public List<StructuredQName> 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.

  Changed in Saxon 9.0 to return a list of StructuredQName values rather than integers

  Returns:
    the list of variable names for this stack frame

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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