Class OldValuesTable


  • public class OldValuesTable
    extends Object
    A symbol table-like data structure used to hold old values, needed to support internal/recursive method calls.
    • Constructor Detail

      • OldValuesTable

        public OldValuesTable()
        Creates a new empty table.
    • Method Detail

      • enter

        public void enter​(String methodSignature)
        Enters a new scope for a given method.
        Parameters:
        methodSignature - the signature of the method.
      • leave

        public void leave()
        Leaves the current scope.
      • getValue

        public Object getValue​(String key)
        Gets the value hold by the table in the current scope for a given key.
        Parameters:
        key - A string key (e.g., a variable name).
        Returns:
        an object value.
      • putValue

        public void putValue​(String key,
                             Object value)
        Adds a key-value pair in the current scope.
        Parameters:
        key - a string key (e.g., a variable name).
        value - an object value.
      • containsKey

        public boolean containsKey​(String key)
        Checks if a key has been stored in the table.
        Parameters:
        key - a string key (e.g., the name of a variable).
        Returns:
        true iff the value has been stored in the table.