ArgParser.Arg (OpenMap API)
Date: 2016-12-09

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

## com.bbn.openmap.util
Class ArgParser.Arg

    java.lang.Object
      com.bbn.openmap.util.ArgParser.Arg

Direct Known Subclasses:
  ArgParser.HelpArg

Enclosing class:
  ArgParser

    public class ArgParser.Arg

extends java.lang.Object

A default version of the Arg class used to represent options for the ArgParser to use.

Field Summary
`char` | `c`
`boolean` | `dashedArguments`
`java.lang.String` | `description`
`boolean` | `flagged`
`java.lang.String` | `name`
`int` | `numExpectedValues`
`java.lang.String[]` | `values`

Constructor Summary
`ArgParser.Arg(java.lang.String aName, java.lang.String desc)` Create an Arg with a name and help line description.
`ArgParser.Arg(java.lang.String aName, java.lang.String desc, int expectedNumberOfArguments)` Create an Arg with a name and help line description, along with a number of expected arguments to follow this option.
`ArgParser.Arg(java.lang.String aName, java.lang.String desc, int expectedNumberOfArguments, boolean expectDashedArguments)` Create an Arg with a name and help line description, along with a number of expected arguments to follow this option.

Method Summary
`boolean` | `is(java.lang.String arg, boolean allowAbbr)` Returns true if the atg string matches the name of the Arg, or, if allowAbbr is true, returns true if the arg length is one and it matches the first letter of the arg name.
`boolean` | `readArgs(java.lang.String[] argv, int argIndex)` Runs through the array of Strings, starting at the argIndex, and creates the values array from it.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### name

    public java.lang.String name

### description

    public java.lang.String description

### numExpectedValues

    public int numExpectedValues

### values

    public java.lang.String[] values

### c

    public char c

### flagged

    public boolean flagged

### dashedArguments

    public boolean dashedArguments

Constructor Detail

### ArgParser.Arg

    public ArgParser.Arg(java.lang.String aName,
                         java.lang.String desc)

  Create an Arg with a name and help line description.

  Parameters:
    `aName` - name of arg
    `desc` - description of arg, used in usage statement

### ArgParser.Arg

    public ArgParser.Arg(java.lang.String aName,
                         java.lang.String desc,
                         int expectedNumberOfArguments)

  Create an Arg with a name and help line description, along with a number of expected arguments to follow this option.

  Parameters:
    `aName` - name of arg
    `desc` - description of arg, used in usage statement
    `expectedNumberOfArguments` - number of values expected for argument

### ArgParser.Arg

    public ArgParser.Arg(java.lang.String aName,
                         java.lang.String desc,
                         int expectedNumberOfArguments,
                         boolean expectDashedArguments)

  Create an Arg with a name and help line description, along with a number of expected arguments to follow this option. Has an argument to not check for arguments that may start with dashes, in case one of the arguments may be a negative number.

  Parameters:
    `aName` - name of arg
    `desc` - description of arg, used in usage statement
    `expectedNumberOfArguments` - number of values expected for argument
    `expectDashedArguments` - if they could be dashed (like a negative number)

Method Detail

### is

    public boolean is(java.lang.String arg,
                      boolean allowAbbr)

  Returns true if the atg string matches the name of the Arg, or, if allowAbbr is true, returns true if the arg length is one and it matches the first letter of the arg name.

  Parameters:
    `arg` - string to test
    `allowAbbr` - ok to check first letter
  Returns:
    true if a match

### readArgs

    public boolean readArgs(java.lang.String[] argv,
                            int argIndex)
                     throws java.lang.ArrayIndexOutOfBoundsException,
                            java.lang.NegativeArraySizeException

  Runs through the array of Strings, starting at the argIndex, and creates the values array from it. Uses the expected number of arguments to tell when it's done. Returns true if everything happens as expected.

  Parameters:
    `argv` - the entire array passed to the parser.
    `argIndex` - the index of the first option argument value.
  Returns:
    true if what was read was what was expected.
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NegativeArraySizeException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details