org.apache.jdo.impl.jdoql.scope
Class VariableTable

java.lang.Object
  extended byorg.apache.jdo.impl.jdoql.scope.AbstractValueTable
      extended byorg.apache.jdo.impl.jdoql.scope.VariableTable
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, ValueTable

public class VariableTable
extends AbstractValueTable

The variable table.

Version:
0.1
Author:
Michael Bouschen
See Also:
Serialized Form

Field Summary
(package private)  java.util.Map declMap
          Map of declarations.
protected static I18NHelper msg
          I18N support
(package private)  java.util.Map valueMap
          Map of values.
 
Constructor Summary
VariableTable()
           
 
Method Summary
protected  void checkDeclaredIdentifier(java.lang.String name, Declaration decl)
          Internal method to check whether the specified identifier is declared.
 void declare(Declaration decl)
          Adds a new declaration.
 VariableTable getCopy()
          Returns a copy of this VariableTable.
 java.lang.Object getValue(java.lang.String name)
          Returns the current value for the specified identifier.
 void initValueHandling()
          This method initializes the map of values for this ValueTable.
 boolean isCompatibleValue(java.lang.String name, java.lang.Object value)
          Checks whether the type of the specified value is compatible of the type of the identifier from its declaration.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets the value for the specified identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

declMap

java.util.Map declMap
Map of declarations. Key is the the name of the declared identifier, value is the Declaration node.


valueMap

transient java.util.Map valueMap
Map of values. This map includes a values entry for each declared identifier. Default value is UNDEFINED.


msg

protected static final I18NHelper msg
I18N support

Constructor Detail

VariableTable

public VariableTable()
Method Detail

getCopy

public VariableTable getCopy()
Returns a copy of this VariableTable.

Returns:
a copy of this VariableTable.

checkDeclaredIdentifier

protected void checkDeclaredIdentifier(java.lang.String name,
                                       Declaration decl)
Internal method to check whether the specified identifier is declared.

Specified by:
checkDeclaredIdentifier in class AbstractValueTable

declare

public void declare(Declaration decl)
Adds a new declaration. The value is set to UNDEFINED.

Specified by:
declare in interface ValueTable
Parameters:
decl - the declaration node

initValueHandling

public void initValueHandling()
This method initializes the map of values for this ValueTable. It needs to be called prior to any use of an AbstractValueTable at query execution time.


setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Sets the value for the specified identifier.

Specified by:
setValue in interface ValueTable
Parameters:
name - the name of the identifier
value - the current value of the identifier

getValue

public java.lang.Object getValue(java.lang.String name)
Returns the current value for the specified identifier.

Specified by:
getValue in interface ValueTable
Parameters:
name - the name of the identifier
Returns:
the current value of the identifier

isCompatibleValue

public boolean isCompatibleValue(java.lang.String name,
                                 java.lang.Object value)
Checks whether the type of the specified value is compatible of the type of the identifier from its declaration.

Specified by:
isCompatibleValue in interface ValueTable
Parameters:
name - the name of the identifier
value - the value to be checked
Returns:
true if the type of the value is compatible with the type of the identifier; false otherwise.