blob: a567fbb6e0b99ed3a5a23195d1755de5065477bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package ch.epfl.xblast;
/**
* ArgumentChecker.
*
* @author Pacien TRAN-GIRARD (261948)
* @author Timothée FLOURE (257420)
*/
public final class ArgumentChecker {
/**
* Returns the given value if it is non-negative.
*
* @param value the tested value
* @throws IllegalArgumentException if the value is inferior to 0
* @return the given value if non-negative
*/
public static int requireNonNegative(int value) {
if (value >= 0) {
return value;
} else {
throw new IllegalArgumentException();
}
}
}
|