aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl/xblast/ArgumentChecker.java
blob: 311807eb9f35e7b9a00cb957df899395dfd35124 (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
26
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();
        }
    }

}