Class CFGOptionMatcher


  • public class CFGOptionMatcher
    extends Object
    A class used by CFG utilities that need to match different option strings with classes that implement those options. A CFGOptionMatcher maintains a set of named options, and provides a means for matching abbreviated option values against those names.
    • Constructor Detail

      • CFGOptionMatcher

        public CFGOptionMatcher​(CFGOptionMatcher.CFGOption[] options)
        Creates a CFGOptionMatcher.
        Parameters:
        options - The set of command options to be stored.
    • Method Detail

      • match

        public CFGOptionMatcher.CFGOption match​(String quarry)
                                         throws CompilationDeathException
        Searches the options in this CFGOptionMatcher looking for one whose name begins with the passed string (ignoring the case of letters in the string).
        Parameters:
        quarry - The string to be matched against the stored option names.
        Returns:
        The matching CFGOptionMatcher.CFGOption, if exactly one of the stored option names begins with quarry.
        Throws:
        CompilationDeathException - if quarry matches none of the option names, or if it matches more than one.
      • help

        public String help​(int initialIndent,
                           int rightMargin,
                           int hangingIndent)
        Returns a string containing the names of all the options in this CFGOptionMatcher, separated by '|' characters. The string is intended for use in help messages.
        Parameters:
        initialIndent - The number of blank spaces to insert at the beginning of the returned string. Ignored if negative.
        rightMargin - If positive, newlines will be inserted to try to keep the length of each line in the returned string less than or equal to rightMargin.
        hangingIndent - If positive, this number of spaces will be inserted immediately after each newline inserted to respect the rightMargin.