Passed
Push — master ( 27e47c...011406 )
by Vincent
03:32
created

fr.arakne.utils.value.constant.Race.byId(int)   A

Complexity

Conditions 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
cc 3
rs 10
ccs 3
cts 3
cp 1
crap 3
1
/*
2
 * This file is part of ArakneUtils.
3
 *
4
 * ArakneUtils is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * ArakneUtils is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with ArakneUtils.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2017-2020 Vincent Quatrevieux
18
 */
19
20
package fr.arakne.utils.value.constant;
21
22
/**
23
 * List of available character races
24
 */
25 1
public enum Race {
26 1
    NO_CLASS,
27 1
    FECA,
28 1
    OSAMODAS,
29 1
    ENUTROF,
30 1
    SRAM,
31 1
    XELOR,
32 1
    ECAFLIP,
33 1
    ENIRIPSA,
34 1
    IOP,
35 1
    CRA,
36 1
    SADIDA,
37 1
    SACRIEUR,
38 1
    PANDAWA;
39
40
    /**
41
     * Get a character race by its id
42
     *
43
     * @param id The race id
44
     *
45
     * @throws IndexOutOfBoundsException
46
     */
47
    static public Race byId(int id) {
48 1
        if (id >= values().length || id == 0) {
49 1
            throw new IndexOutOfBoundsException("Invalid race " + id);
50
        }
51
52 1
        return values()[id];
53
    }
54
}
55