Class ParserLocal<T>

  • Type Parameters:
    T - the variable type

    public class ParserLocal<T>
    extends java.lang.Object
    Used to create a reference to a variable held by a ParsingContext.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParserLocal()
      Constructs a new ParserLocal.
      ParserLocal​(T defaultValue)
      Constructs a new ParserLocal.
    • Constructor Detail

      • ParserLocal

        public ParserLocal()
        Constructs a new ParserLocal.
      • ParserLocal

        public ParserLocal​(T defaultValue)
        Constructs a new ParserLocal.
        Parameters:
        defaultValue - the default value
    • Method Detail

      • createDefaultValue

        protected T createDefaultValue()
        Called when initialized to return a default value. If not overridden, it returns the default value passed via the constructor.
        Returns:
        the default value
      • init

        public final void init​(int index,
                               ParsingContext context)
        Initializes the variable.
        Parameters:
        index - the index of the variable in the heap
        context - the ParsingContext being initialized
      • get

        public final T get​(ParsingContext context)
        Gets the value.
        Parameters:
        context - the ParsingContext to get the value from
        Returns:
        the value
      • set

        public final void set​(ParsingContext context,
                              T obj)
        Sets the value.
        Parameters:
        context - the ParsingContext to set the value on
        obj - the value