|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.query.sql.util.VariableContext
public class VariableContext
This class holds a map of variables to their values, these variables and
their values are held in the context of a Block
in the procedure language,
differrent Statement
s populate the map by declaring variables and
assigning values. This class holds reference to a parent VariableContext
that holds variable info for parent Block
. The variable declared at
the parent level is available to its immediate child context and any children,
down the heirarchy.
Constructor Summary | |
---|---|
VariableContext()
Constructor for VariableContext. |
|
VariableContext(java.util.Map variableMap)
Constructor for VariableContext. |
Method Summary | |
---|---|
boolean |
containsVariable(ElementSymbol variable)
Check if this context or any of it's parent contexts contain this variable |
void |
getFlattenedContextMap(java.util.Map values)
Helper Methods |
VariableContext |
getParentContext()
Get the parent context for this variable context. |
java.lang.Object |
getValue(ElementSymbol variable)
Get the value for the given variable, if the variable exits in the current context just return the value of the variable else lookup the parent context and return the value of the variable. |
boolean |
isEmpty()
Check if the current context and its parents contain any variables |
void |
setParentContext(VariableContext parent)
Set the parent variable context for this variable context, when looking up the variable's value, if the variable is not present in the current context, the parent context is lookedup. |
void |
setValue(ElementSymbol variable,
java.lang.Object value)
Set the value for the given, if the variable aready exits replaces its value with the given value else adds a new variable to the map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VariableContext()
public VariableContext(java.util.Map variableMap)
Method Detail |
---|
public void setValue(ElementSymbol variable, java.lang.Object value)
variable
- The ElementSymbol
to be added as a variable.value
- The value to be set for the given variable.public java.lang.Object getValue(ElementSymbol variable)
variable
- The ElementSymbol
whose value needs to be returned.
public void setParentContext(VariableContext parent)
parent
- The parent VariableContext
.public VariableContext getParentContext()
VariableContext
.public void getFlattenedContextMap(java.util.Map values)
public boolean containsVariable(ElementSymbol variable)
variable
- The variable which may be present on this context
public boolean isEmpty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |