Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| HTML Parser Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Field Summary
`protected List` | `commands`
`protected List` | `flags`
`protected List` | `names`
`protected Map` | `values`
`static boolean` | `VERBOSE`

Constructor Summary
`CommandLine(String[] args)`
`CommandLine(String chars, String[] args)`

Method Summary
`void` | `addCommand(char command)`
`boolean` | `getFlag(String key)`
`String` | `getName(int index)`
`int` | `getNameCount()`
`String` | `getValue(String key)`
`boolean` | `hasValue(String key)`
`static void` | `main(String[] args)`
`protected void` | `parse(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 List commands

### flags

    protected List flags

### names

    protected List names

### values

    protected Map values

Constructor Detail

### CommandLine

    public CommandLine(String chars,
                       String[] args)

### CommandLine

    public CommandLine(String[] args)

Method Detail

### 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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2004 Somik Raha Mar 14, 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

HTML Parser is an open source library released under LGPL.