org.quattor.pan.template
Class LocalVariableMap

java.lang.Object
  extended by org.quattor.pan.template.LocalVariableMap

public class LocalVariableMap
extends java.lang.Object

This class contains a map intended to hold the definition of local variables.

Author:
loomis

Constructor Summary
LocalVariableMap()
          Create an instance that contains no local variable mappings initially.
LocalVariableMap(ListResource argv)
          Create an instance that contains mappings for the variables ARGV and ARGC.
 
Method Summary
 Element get(java.lang.String name)
          Lookup the value associated with the given variable name.
 Element put(java.lang.String name, Element value)
          Assign the value to the given variable name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalVariableMap

public LocalVariableMap()
Create an instance that contains no local variable mappings initially.


LocalVariableMap

public LocalVariableMap(ListResource argv)
Create an instance that contains mappings for the variables ARGV and ARGC. This is typical of a function call initialization. If this is called with a null argument, then ARGV and ARGC are not set.

Parameters:
argv - ListResource to use to set ARGV and ARGC variables
Method Detail

get

public Element get(java.lang.String name)
Lookup the value associated with the given variable name. If the name isn't defined, then null is returned.

Parameters:
name - variable name to lookup
Returns:
Element associated with the given name or null if it doesn't exist

put

public Element put(java.lang.String name,
                   Element value)
Assign the value to the given variable name. If the value is null, then the variable is undefined. If an old value existed, then this method will check that the new value is a valid replacement for the old one. If not, an exception will be thrown.

Parameters:
name - variable name to assign value to
value - Element to assign to the given variable name; variable is removed if the value is null
Returns:
old value of the named variable or null if it wasn't defined


Copyright © 2011 Quattor. All Rights Reserved.