org.htmlparser.util
Class CommandLine
java.lang.Object
org.htmlparser.util.CommandLine
- public class CommandLine
- extends 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.
- Author:
- Claude Duguay
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VERBOSE
public static boolean VERBOSE
commands
protected List commands
flags
protected List flags
names
protected List names
values
protected Map values
CommandLine
public CommandLine(String chars,
String[] args)
CommandLine
public CommandLine(String[] args)
parse
protected void parse(String[] args)
addCommand
public void addCommand(char command)
hasValue
public boolean hasValue(String key)
getValue
public String getValue(String key)
getFlag
public boolean getFlag(String key)
getNameCount
public int getNameCount()
getName
public String getName(int index)
main
public static void main(String[] args)
HTML Parser is an open source library released under LGPL.