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

## com.caucho.xpath
Class Env

    java.lang.Object
      |
      +--com.caucho.xpath.Env

public class Env
extends java.lang.Object

Global and local variable environment. The April XSLT draft introduces global and local variables. The Env class contains those bindings.

Because this class exists only to support XSL, it makes a number of assumptions that would be invalid for a typical API. Specifically, the variable names must be interned strings, i.e. variable matching uses '==', not equals.

Local variables are handled like a stack. They are pushed and popped as necessary. The top variables shadow bottom variables.

In other words, although the API somewhat resembles a HashMap, it can't be used as a generic hash map.

Constructor Summary
`Env()`

Method Summary
`void` | `addVar(java.lang.String name, java.lang.Object value)` Adds the value associated with name.
`void` | `clear()` Clears all values in the local environment.
`java.lang.Object` | `getCache(java.lang.Object key)`
`java.lang.Object` | `getVar(java.lang.String name)` Returns the value associated with name.
`void` | `popVars(int count)` Pops the last count vars from the local stack.
`void` | `setCache(java.lang.Object key, java.lang.Object value)`
`java.util.HashMap` | `setFunctions(java.util.HashMap functions)` Sets the extension function library
`void` | `setGlobal(java.lang.String name, java.lang.Object value)` Sets a global variable.

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

Constructor Detail

### Env

    public Env()

Method Detail

### clear

    public void clear()

  Clears all values in the local environment.

### getVar

    public java.lang.Object getVar(java.lang.String name)

  Returns the value associated with name.

  name must be interned

### addVar

    public void addVar(java.lang.String name,
                       java.lang.Object value)

  Adds the value associated with name.

  name must be interned

### popVars

    public void popVars(int count)

  Pops the last count vars from the local stack.

### setGlobal

    public void setGlobal(java.lang.String name,
                          java.lang.Object value)

  Sets a global variable.

### setFunctions

    public java.util.HashMap setFunctions(java.util.HashMap functions)

  Sets the extension function library
  Parameters:
    `function` - new function library
  Returns:
    old function library

### getCache

    public java.lang.Object getCache(java.lang.Object key)

### setCache

    public void setCache(java.lang.Object key,
                         java.lang.Object value)

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