adavid.util
Class CommandSorter

java.lang.Object
  |
  +--adavid.util.CommandSorter

public class CommandSorter
extends java.lang.Object


Constructor Summary
CommandSorter(java.lang.String[] args)
          default constructor: the prefixes are "-+"
CommandSorter(java.lang.String[] args, java.lang.String option)
          constructor: just take and store the command line, and the option prefix definition
 
Method Summary
 java.lang.String[] getAllArgs()
          returns all arguments which are not options
 java.lang.String[] getAllOptions()
          returns all options found
 java.lang.String getArg(java.lang.String opt)
          returns the argument of an option: null if the option was not found, "" if no argument, "...something" if the argument is found the option should be complete, for example: "-o" for the option -o
 java.lang.String[] getArgs()
          returns the arguments which are not arguments of an option
 java.lang.String[] getArgsAfter(java.lang.String opt)
          returns all arguments after a given option
 java.lang.String getDefinition(java.lang.String option)
          returns the definition of an option: -option=something : getDefinition("-option") returns "something" returns null if the option is not defined and "" if the definition string is empty -option = something ; -option= something ; -option =something are not recognized
 boolean isDefined(java.lang.String arg)
          returns true if the argument is defined options of the form -blabla=something are not counted
 boolean isOption(java.lang.String string)
          returns true if the string "string" begins with one of the characters in option, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandSorter

public CommandSorter(java.lang.String[] args,
                     java.lang.String option)
constructor: just take and store the command line, and the option prefix definition

CommandSorter

public CommandSorter(java.lang.String[] args)
default constructor: the prefixes are "-+"
Method Detail

isOption

public boolean isOption(java.lang.String string)
returns true if the string "string" begins with one of the characters in option, i.e. if it is an option declaration

getArgs

public java.lang.String[] getArgs()
returns the arguments which are not arguments of an option

getAllArgs

public java.lang.String[] getAllArgs()
returns all arguments which are not options

getAllOptions

public java.lang.String[] getAllOptions()
returns all options found

isDefined

public boolean isDefined(java.lang.String arg)
returns true if the argument is defined options of the form -blabla=something are not counted

getArg

public java.lang.String getArg(java.lang.String opt)
returns the argument of an option: null if the option was not found, "" if no argument, "...something" if the argument is found the option should be complete, for example: "-o" for the option -o

getArgsAfter

public java.lang.String[] getArgsAfter(java.lang.String opt)
returns all arguments after a given option

getDefinition

public java.lang.String getDefinition(java.lang.String option)
returns the definition of an option: -option=something : getDefinition("-option") returns "something" returns null if the option is not defined and "" if the definition string is empty -option = something ; -option= something ; -option =something are not recognized