Package edu.uky.ai.util
Class Arguments
java.lang.Object
edu.uky.ai.util.Arguments
A more convenient representation of command line argument based on keys and
values. A key is an argument that starts with a dash "-" character. Every
other argument is considered a value.
- Author:
- Stephen G. Ware
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
groups
Arguments, divided into groups. Each group (except the first) begins with a key and contains all the values that follow that key. The first group is all values before the first key.
-
-
Constructor Details
-
Arguments
Constructs a new group of argument from an array of strings.- Parameters:
args
- the command line arguments
-
-
Method Details
-
containsKey
Checks whether a given key is present in the arguments.- Parameters:
key
- the key to look for, including the initial dash- Returns:
- true if the key is present, false otherwise
-
getValue
Returns the value immediately after a given key.- Parameters:
key
- the key to look for, including the initial dash- Returns:
- the value following the key
- Throws:
IllegalArgumentException
- if the key is not present, if there is no value after the key, or if there is more than one value after the key
-
getValues
Returns the values (0, 1, or many) immediately after a given key.- Parameters:
key
- the key to look for, including the initial dash- Returns:
- the values following the key
- Throws:
IllegalArgumentException
- if the key is not present
-