Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.htmlparser.util
Class CommandLine  view CommandLine download CommandLine.java

java.lang.Object
  extended byorg.htmlparser.util.CommandLine

public class CommandLine
extends java.lang.Object

Simple command like parser/handler. A dashed argument is one preceded by a dash character. In a sequence of arguments: 1) If a dashed argument starts with a command character the rest of the argument, if any, is assume to be a value. 2) If a dashed argument is followed by a non-dashed argument value. The value is assumed to be associated with the preceding dashed argument name. 2) If an argument with a dash prefix is not followed by a non-dashed value, and does not use a command character, it is assumed to be a flag. 3) If none of the above is true, the argument is a name. Command characters can be added with the addCommand method. Values can be retrieved with the getValue method. Flag states can be retrieved with the getFlag method. Names can be retieved with the getNameCount and getName methods.


Field Summary
protected  java.util.List commands
           
protected  java.util.List flags
           
protected  java.util.List names
           
protected  java.util.Map values
           
static boolean VERBOSE
           
 
Constructor Summary
CommandLine(java.lang.String[] args)
           
CommandLine(java.lang.String chars, java.lang.String[] args)
           
 
Method Summary
 void addCommand(char command)
           
 boolean getFlag(java.lang.String key)
           
 java.lang.String getName(int index)
           
 int getNameCount()
           
 java.lang.String getValue(java.lang.String key)
           
 boolean hasValue(java.lang.String key)
           
static void main(java.lang.String[] args)
           
protected  void parse(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

public static boolean VERBOSE

commands

protected java.util.List commands

flags

protected java.util.List flags

names

protected java.util.List names

values

protected java.util.Map values
Constructor Detail

CommandLine

public CommandLine(java.lang.String chars,
                   java.lang.String[] args)

CommandLine

public CommandLine(java.lang.String[] args)
Method Detail

parse

protected void parse(java.lang.String[] args)

addCommand

public void addCommand(char command)

hasValue

public boolean hasValue(java.lang.String key)

getValue

public java.lang.String getValue(java.lang.String key)

getFlag

public boolean getFlag(java.lang.String key)

getNameCount

public int getNameCount()

getName

public java.lang.String getName(int index)

main

public static void main(java.lang.String[] args)