Class ScopedVariableSet


  • public final class ScopedVariableSet
    extends java.lang.Object
    A simple stack for VariableSets
    Version:
    $Revision: 3633 $ $Date: 2003-03-01 08:38:44 +0100 (Sat, 01 Mar 2003) $
    Author:
    Keith Visco
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_SIZE
      The default size.
    • Constructor Summary

      Constructors 
      Constructor Description
      ScopedVariableSet()
      Creates a new ScopedVariableSet
      ScopedVariableSet​(int size)
      Creates a new ScopedVariableSet using the givin size
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add()
      adds a new VariableSet, which is then set as the current scope.
      VariableSet current()
      Returns the VariableSet currently in scope.
      XPathResult getVariable​(java.lang.String name)
      Returns the value of a variable.
      void remove()
      Removes the current VariableSet scope.
      void setVariable​(java.lang.String name, XPathResult value)
      Binds the XPath result to the variable name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • ScopedVariableSet

        public ScopedVariableSet()
        Creates a new ScopedVariableSet
      • ScopedVariableSet

        public ScopedVariableSet​(int size)
        Creates a new ScopedVariableSet using the givin size
        Parameters:
        size - the number of VariableSet objects to pre-initialize. This must be a non-negative integer.
    • Method Detail

      • current

        public VariableSet current()
        Returns the VariableSet currently in scope.
        Returns:
        the VariableSet currently in scope.
      • getVariable

        public XPathResult getVariable​(java.lang.String name)
        Returns the value of a variable. Returns null if a variable with this name was not found in this variable bindings, or any parent variable binding.
        Parameters:
        name - The variable name
        Returns:
        The variable's value as an XPath result, or null
      • setVariable

        public void setVariable​(java.lang.String name,
                                XPathResult value)
        Binds the XPath result to the variable name. The result will be returned from subsequent call to getVariable(java.lang.String) using the same variable name.
        Parameters:
        name - The variable name
        value - The variable's value
      • remove

        public void remove()
        Removes the current VariableSet scope.
      • add

        public void add()
        adds a new VariableSet, which is then set as the current scope.