Class CmdLineParser.CmdLineImpl

  • All Implemented Interfaces:
    Parameters
    Enclosing class:
    CmdLineParser

    private class CmdLineParser.CmdLineImpl
    extends java.lang.Object
    implements Parameters
    Essentially a pointer over a String array. Can move forward; can look ahead.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String[] args  
      private int pos  
    • Constructor Summary

      Constructors 
      Constructor Description
      CmdLineImpl​(java.lang.String[] args)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getCurrentToken()  
      java.lang.String getParameter​(int idx)
      Gets the additional parameter to this option.
      protected boolean hasMore()  
      private void proceed​(int n)  
      int size()
      Number of remaining tokens.
      (package private) void splitToken()
      Used when the current token is of the form "-option=value", to replace the current token by "value", as if this was given as two tokens "-option value"
      • Methods inherited from class java.lang.Object

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

      • args

        private final java.lang.String[] args
      • pos

        private int pos
    • Constructor Detail

      • CmdLineImpl

        CmdLineImpl​(java.lang.String[] args)
    • Method Detail

      • hasMore

        protected boolean hasMore()
      • getCurrentToken

        protected java.lang.String getCurrentToken()
      • proceed

        private void proceed​(int n)
      • getParameter

        public java.lang.String getParameter​(int idx)
                                      throws CmdLineException
        Description copied from interface: Parameters
        Gets the additional parameter to this option.
        Specified by:
        getParameter in interface Parameters
        Parameters:
        idx - specifying 0 will retrieve the token next to the option. For example, if the command line looks like -o abc -d x, then getParameter(0) for -o returns abc and getParameter(1) will return -d.
        Returns:
        Always return non-null valid String. If an attempt is made to access a non-existent index, this method throws appropriate CmdLineException.
        Throws:
        CmdLineException
      • size

        public int size()
        Description copied from interface: Parameters
        Number of remaining tokens.
        Specified by:
        size in interface Parameters
      • splitToken

        void splitToken()
        Used when the current token is of the form "-option=value", to replace the current token by "value", as if this was given as two tokens "-option value"