Class CommandLine
java.lang.Object
jcuda.utils.CommandLine
Command line argument utility functions, similar to the CUTIL
functions.
All command line arguments begin with '--' followed by the token. The token and value are separated by '='.
Example:
Arrays have the form
All command line arguments begin with '--' followed by the token. The token and value are separated by '='.
Example:
--samples=50
Arrays have the form
--model=[one.obj,two.obj,three.obj]
(without whitespaces)-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkCommandLineFlag
(String[] argv, String flagName) Returns whether the given command line arguments contain an argument with the given name (the name must be given without the "--" prefix);static float
getCommandLineArgumentFloat
(String[] argv, String argName, float defaultValue) Returns the value of the command line argument with the given name as a float.static int
getCommandLineArgumentInt
(String[] argv, String argName, int defaultValue) Returns the value of the command line argument with the given name as an int.getCommandLineArgumentListString
(String[] argv, String argName) Returns the value of the command line argument with the given name as a list of strings.static String
getCommandLineArgumentString
(String[] argv, String argName) Returns the value of the command line argument with the given name as a String.
-
Method Details
-
checkCommandLineFlag
Returns whether the given command line arguments contain an argument with the given name (the name must be given without the "--" prefix);- Parameters:
argv
- The argumentsflagName
- The argument to look for- Returns:
- Whether the argument is found
-
getCommandLineArgumentInt
Returns the value of the command line argument with the given name as an int.- Parameters:
argv
- The argumentsargName
- The name of the argumentdefaultValue
- The default value to use of no value was given- Returns:
- The value of the argument
- Throws:
IllegalArgumentException
- If the given argument has no appropriate value
-
getCommandLineArgumentFloat
Returns the value of the command line argument with the given name as a float.- Parameters:
argv
- The argumentsargName
- The name of the argumentdefaultValue
- The default value to use of no value was given- Returns:
- The value of the argument
- Throws:
IllegalArgumentException
- If the given argument has no appropriate value
-
getCommandLineArgumentString
-
getCommandLineArgumentListString
Returns the value of the command line argument with the given name as a list of strings.- Parameters:
argv
- The argumentsargName
- The name of the argument- Returns:
- The value of the argument
- Throws:
IllegalArgumentException
- If the given argument has no appropriate value
-