Class CommandManager

    • Constructor Summary

      Constructors 
      Constructor Description
      CommandManager()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract HelpTree.Node getHelp()
      Get an object embodying the command line help for the commands managed by this CommandManager.
      protected static boolean isMatch​(java.lang.String s1, java.lang.String s2)
      A convenience routine for subtypes to use to see if one string matches another.
      protected static boolean isMatch​(java.lang.String s1, java.lang.String[] s2)
      A convenience routine for subtypes to use to see if a string matches one of a set of strings.
      protected static boolean isPrefixMatch​(java.lang.String arg, java.lang.String prefix)
      A convenience routine for subtypes to use to see if a string matches a prefix string.
      abstract boolean parseCommand​(java.lang.String cmd, java.util.ListIterator argIter, CommandContext ctx)
      Parse a command (and any arguments it might take).
      • Methods inherited from class java.lang.Object

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

      • CommandManager

        public CommandManager()
    • Method Detail

      • getHelp

        public abstract HelpTree.Node getHelp()
        Get an object embodying the command line help for the commands managed by this CommandManager.
        Returns:
        an object embodying the command line help for the commands managed by this CommandManager
      • parseCommand

        public abstract boolean parseCommand​(java.lang.String cmd,
                                             java.util.ListIterator argIter,
                                             CommandContext ctx)
                                      throws Command.Fault
        Parse a command (and any arguments it might take).
        Parameters:
        cmd - the command to be parsed
        argIter - an iterator from which to get any arguments that might be required by the option
        ctx - a context object to use while parsing the command
        Returns:
        true if the command is recognized and successfully parsed, or false if the command is not recognized by this command manager
        Throws:
        Command.Fault - if the command is recognized by this command manager but could not be successfully parsed or otherwise handled.
      • isMatch

        protected static boolean isMatch​(java.lang.String s1,
                                         java.lang.String s2)
        A convenience routine for subtypes to use to see if one string matches another. The two strings match if they are equal, ignoring case.
        Parameters:
        s1 - A string, such as the command name, to be matched
        s2 - Another string, such as a command name, to be matched
        Returns:
        true if the strings match, and false otherwise
      • isMatch

        protected static boolean isMatch​(java.lang.String s1,
                                         java.lang.String[] s2)
        A convenience routine for subtypes to use to see if a string matches one of a set of strings. Two strings match if they are equal, ignoring case.
        Parameters:
        s1 - A string, such as the command name, to be matched
        s2 - An array of strings, such as command names, to be matched
        Returns:
        true if a match is found, and false otherwise
      • isPrefixMatch

        protected static boolean isPrefixMatch​(java.lang.String arg,
                                               java.lang.String prefix)
        A convenience routine for subtypes to use to see if a string matches a prefix string. A match occurs if the argument string begins with the prefix string, ignoring case.
        Parameters:
        arg - A string, such as the command name, to be matched
        prefix - The prefix to be matched
        Returns:
        true if a match is found, and false otherwise