blob: 589c197cd5c09c7c7db4ec5ec360300618f0e220 (
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
25
|
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
* @return the given value if non-negative
* @throws IllegalArgumentException if the value is inferior to 0
*/
public static int requireNonNegative(int value) {
if (value >= 0)
return value;
else
throw new IllegalArgumentException();
}
}
|