Package com.compomics.software.cli
Class CommandParameter
java.lang.Object
com.compomics.software.cli.CommandParameter
Convenience methods for the validation of command line parameters.
- Author:
- Marc Vaudel, Harald Barsnes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfileExists(String argType, String arg) Returns true if the argument can be parsed as a file and the file exists.static booleanfileExists(String argType, String arg, HashSet<String> formats) Returns true if the argument can be parsed as a file, the file exists and is in the specified format.static booleaninDoubleRange(String argType, String arg, double minValue, double maxValue) Returns true if the input is a double value inside the given range.static booleaninIntegerRange(String argType, String arg, int minValue, int maxValue) Returns true if the input is an integer value inside the given range.static booleanisBooleanInput(String argType, String arg) Returns true of the input is 0 or 1.static booleanReturns true if the argument can be parsed as a double value.static booleanReturns true of the input is in the provided list.static booleanReturns true of the input is in the provided list.static booleanReturns true if the argument can be parsed as an integer value.static booleanisPositiveDouble(String argType, String arg, boolean allowZero) Returns true if the argument can be parsed as a positive double value.static booleanisPositiveInteger(String argType, String arg, boolean allowZero) Returns true if the argument can be parsed as a positive integer value.static booleanisSequenceMatchingType(String argType, String arg) Returns true of the input is in the provided list.
-
Constructor Details
-
CommandParameter
public CommandParameter()
-
-
Method Details
-
inIntegerRange
Returns true if the input is an integer value inside the given range.- Parameters:
argType- the name of the argumentarg- the content of the argumentminValue- the minimum value allowedmaxValue- the maximum value allowed- Returns:
- true if the input is an integer value inside the given range
-
inDoubleRange
Returns true if the input is a double value inside the given range.- Parameters:
argType- the name of the argumentarg- the content of the argumentminValue- the minimum value allowedmaxValue- the maximum value allowed- Returns:
- true if the input is a double value inside the given range
-
isInList
Returns true of the input is in the provided list.- Parameters:
argType- the name of the argumentarg- the content of the argumentsupportedInput- the list of supported input- Returns:
- true of the input is in the list
-
isInList
Returns true of the input is in the provided list.- Parameters:
argType- the name of the argumentarg- the content of the argumentsupportedInput- the list of supported input- Returns:
- true of the input is in the list
-
isBooleanInput
Returns true of the input is 0 or 1.- Parameters:
argType- the name of the argumentarg- the content of the argument- Returns:
- true of the input is 0 or 1
-
isInteger
Returns true if the argument can be parsed as an integer value.- Parameters:
argType- the name of the argumentarg- the content of the argument- Returns:
- true if the argument can be parsed as an integer value
-
isSequenceMatchingType
Returns true of the input is in the provided list.- Parameters:
argType- the name of the argumentarg- the content of the argument- Returns:
- true of the input is in the list
-
isDouble
Returns true if the argument can be parsed as a double value.- Parameters:
argType- the name of the argumentarg- the content of the argument- Returns:
- true if the argument can be parsed as a double value
-
isPositiveDouble
Returns true if the argument can be parsed as a positive double value.- Parameters:
argType- the name of the argumentarg- the content of the argumentallowZero- if true, zero values are allowed- Returns:
- true if the argument can be parsed as a positive double value
-
isPositiveInteger
Returns true if the argument can be parsed as a positive integer value.- Parameters:
argType- the name of the argumentarg- the content of the argumentallowZero- if true, zero values are allowed- Returns:
- true if the argument can be parsed as a positive integer value
-
fileExists
Returns true if the argument can be parsed as a file and the file exists.- Parameters:
argType- the name of the argumentarg- the content of the argument- Returns:
- true if the argument can be parsed as a file and the file exists
-
fileExists
Returns true if the argument can be parsed as a file, the file exists and is in the specified format. The format is case sensitive.- Parameters:
argType- the name of the argumentarg- the content of the argumentformats- The formats allowed as a list, ignored if null- Returns:
- true if the argument can be parsed as a file, the file exists and is in the specified format
-