com.metamatrix.query.sql.util
Class VariableContext

java.lang.Object
  extended by com.metamatrix.query.sql.util.VariableContext

public class VariableContext
extends java.lang.Object


Constructor Summary
VariableContext()
          Constructor for VariableContext.
VariableContext(boolean delegateSets)
           
 
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
 java.lang.Object getGlobalValue(java.lang.String variable)
           
 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
 java.lang.Object remove(ElementSymbol symbol)
           
 void setGlobalValue(java.lang.String variable, java.lang.Object value)
           
 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 already exits replaces its value with the given value else adds a new variable to the map.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableContext

public VariableContext()
Constructor for VariableContext.


VariableContext

public VariableContext(boolean delegateSets)
Method Detail

setGlobalValue

public void setGlobalValue(java.lang.String variable,
                           java.lang.Object value)

getGlobalValue

public java.lang.Object getGlobalValue(java.lang.String variable)
                                throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException

setValue

public void setValue(ElementSymbol variable,
                     java.lang.Object value)
Set the value for the given, if the variable already exits replaces its value with the given value else adds a new variable to the map.

Parameters:
variable - The ElementSymbol to be added as a variable.
value - The value to be set for the given variable.

getValue

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

Parameters:
variable - The ElementSymbol whose value needs to be returned.
Returns:
The value of the given variable

setParentContext

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

Parameters:
parent - The parent VariableContext.

getParentContext

public VariableContext getParentContext()
Get the parent 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.

Returns:
The parent VariableContext.

getFlattenedContextMap

public void getFlattenedContextMap(java.util.Map values)
Helper Methods


containsVariable

public boolean containsVariable(ElementSymbol variable)
Check if this context or any of it's parent contexts contain this variable

Parameters:
variable - The variable which may be present on this context
Returns:
A boolean value indiating if the given variable is present on this context or any of it's parent contexts.

isEmpty

public boolean isEmpty()
Check if the current context and its parents contain any variables

Returns:
A boolean bollean value indicating if this context is empty

remove

public java.lang.Object remove(ElementSymbol symbol)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009. All Rights Reserved.