Class DictStack

All Implemented Interfaces:
Serializable, Cloneable, Iterable<PsyFormalDict<PsyObject>>, Collection<PsyFormalDict<PsyObject>>, List<PsyFormalDict<PsyObject>>, RandomAccess

public class DictStack extends Stack<PsyFormalDict<PsyObject>>
An interpreter’s dictionary stack.
See Also:
  • Constructor Details

  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class ArrayList<PsyFormalDict<PsyObject>>
    • load

      public <T extends PsyObject> T load(String key) throws PsyUndefinedException
      Performs in-depth search for the given key in this stack and returns the associated value.
      Type Parameters:
      T - the type of the value.
      Parameters:
      key - the key.
      Returns:
      the associated value.
      Throws:
      PsyUndefinedException - if the key is not found.
    • load

      public <T extends PsyObject> T load(PsyTextual oKey) throws PsyUndefinedException
      Performs in-depth search for the given textual key in this stack and returns the associated value.
      Type Parameters:
      T - the type of the value.
      Parameters:
      oKey - the textual key.
      Returns:
      the associated value.
      Throws:
      PsyUndefinedException - if the key is not found.
    • where

      public Optional<PsyFormalDict> where(String key)
      Performs in-depth search for the dictionary containing the given key in this stack and returns an Optional contating the dictionary found or empty Optional if not found.
      Parameters:
      key - the key.
      Returns:
      a Optional containing the dictionary found.
    • where

      public Optional<PsyFormalDict> where(PsyTextual oKey)
      Performs in-depth search for the dictionary containing the given textual key in this stack and returns an Optional contating the dictionary found or empty Optional if not found.
      Parameters:
      oKey - the textual key.
      Returns:
      an Optional containing the dictionary found.
    • currentNamespace

      public PsyNamespace currentNamespace()
    • store

      public void store(PsyTextual oKey, PsyObject oValue)
    • begin

      public void begin(PsyFormalDict oDict)
      Pushes the dictionary to this stack.
      Parameters:
      oDict - the formaldict dictionary.
    • end

      public void end() throws PsyDictStackUnderflowException
      Pops a non-permanent dictionary from this stack.
      Throws:
      PsyDictStackUnderflowException - if this stack does not contain non-permanent dictionaries.