2
|
1 package edu.unc.genomics;
|
|
2
|
|
3 import com.beust.jcommander.IParameterValidator;
|
|
4 import com.beust.jcommander.ParameterException;
|
|
5
|
|
6 /**
|
|
7 * @author timpalpant
|
|
8 *
|
|
9 */
|
|
10 public class PositiveIntegerValidator implements IParameterValidator {
|
|
11
|
|
12 /* (non-Javadoc)
|
|
13 * @see com.beust.jcommander.IParameterValidator#validate(java.lang.String, java.lang.String)
|
|
14 */
|
|
15 @Override
|
|
16 public void validate(String name, String value) throws ParameterException {
|
|
17 int n = Integer.parseInt(value);
|
|
18 if (n <= 0) {
|
|
19 throw new ParameterException("Parameter "+name+" must be > 0 (was "+value+")");
|
|
20 }
|
|
21 }
|
|
22
|
|
23 }
|