Module jamal.tools

Class OptionsStore

  • All Implemented Interfaces:
    Identified

    public class OptionsStore
    extends java.lang.Object
    implements Identified
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String OPTIONS_MACRO_ID  
    • Constructor Summary

      Constructors 
      Constructor Description
      OptionsStore()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addOptions​(java.lang.String... options)
      Add the options to this options store.
      void addOptions​(java.util.Set<java.lang.String> options)
      Add the options to this options store.
      java.lang.String getId()
      The name of the macro is `options that starts with a backtick.
      static OptionsStore getInstance​(Processor processor)
      Get the options store that belongs to this processor at this very moment.
      java.util.Set<java.lang.String> getOptions()
      Get the set of options.
      boolean is​(java.lang.String option)
      Decides if a certain option was set in this option store.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OPTIONS_MACRO_ID

        public static final java.lang.String OPTIONS_MACRO_ID
        See Also:
        Constant Field Values
    • Constructor Detail

      • OptionsStore

        public OptionsStore()
    • Method Detail

      • getInstance

        public static OptionsStore getInstance​(Processor processor)
        Get the options store that belongs to this processor at this very moment. Note that this is not safe to store the result of this method for longer time, because the actual store may be changed when the scope of the processor is going up closing a macro nesting level.
        Parameters:
        processor - the processor of which we need the options store
        Returns:
        the options store. If there was no option defined for this processor then it returns a constant empty options store
      • getId

        public java.lang.String getId()
        The name of the macro is `options that starts with a backtick. This is a character that is not allowed in a macro name. This way the macro instances will be stored in the macro register when it gets registered programmatically, but the macro source cannot reference it and also the built-in macro define will not overwrite it.
        Specified by:
        getId in interface Identified
        Returns:
        the constant string `options
      • addOptions

        public void addOptions​(java.lang.String... options)
        Add the options to this options store. If an option starts with the ~ character then it will be removed from the options. This way it is possible to switch off an option.
        Parameters:
        options - the options to add to the store
      • addOptions

        public void addOptions​(java.util.Set<java.lang.String> options)
        Add the options to this options store.
        Parameters:
        options - the options to add to the store
      • getOptions

        public java.util.Set<java.lang.String> getOptions()
        Get the set of options.
        Returns:
        the options set
      • is

        public boolean is​(java.lang.String option)
        Decides if a certain option was set in this option store.
        Parameters:
        option - the option we look for
        Returns:
        true if the option was set for this store