fr.arakne.swflangloader.lang.lang.LangFile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 46
ccs 9
cts 11
cp 0.8182
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A LangFile(URL,SwfFileLoader) 0 2 1
A error(int) 0 2 1
A LangFile(URL) 0 2 1
A info(int) 0 2 1
A pvp(int) 0 2 1
A LangFile(File) 0 2 1
1
/*
2
 * This file is part of ArakneLangLoader.
3
 *
4
 * ArakneLangLoader 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
 * ArakneLangLoader 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 ArakneLangLoader.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2020 Vincent Quatrevieux
18
 */
19
20
package fr.arakne.swflangloader.lang.lang;
21
22
import fr.arakne.swflangloader.lang.BaseLangFile;
23
import fr.arakne.swflangloader.loader.SwfFileLoader;
24
import fr.arakne.swflangloader.parser.mapper.MapperHydrator;
25
26
import java.io.File;
27
import java.io.IOException;
28
import java.net.URL;
29
30
/**
31
 * The lang_xx_xxx.swf file
32
 * Contains translations and global configurations
33
 */
34
final public class LangFile extends BaseLangFile {
35 1
    final static private MapperHydrator<LangFile> HYDRATOR = MapperHydrator.parseAnnotations(LangFile.class);
36
37 1
    public LangFile(URL file, SwfFileLoader loader) throws IOException, InterruptedException {
38 1
        loader.load(file, this, HYDRATOR);
39 1
    }
40
41
    public LangFile(URL file) throws IOException, InterruptedException {
42 1
        this(file, new SwfFileLoader());
43 1
    }
44
45
    public LangFile(File file) throws IOException, InterruptedException {
46
        this(file.toURI().toURL(), new SwfFileLoader());
47
    }
48
49
    /**
50
     * Get an error message (packet Im1)
51
     *
52
     * @param id The error message id
53
     *
54
     * @return The message
55
     */
56
    public String error(int id) {
57 1
        return string("ERROR_" + id);
58
    }
59
60
    /**
61
     * Get an info message (packet Im0)
62
     *
63
     * @param id The info message id
64
     *
65
     * @return The message
66
     */
67
    public String info(int id) {
68 1
        return string("INFOS_" + id);
69
    }
70
71
    /**
72
     * Get an pvp message (packet Im0)
73
     *
74
     * @param id The pvp message id
75
     *
76
     * @return The message
77
     */
78
    public String pvp(int id) {
79 1
        return string("PVP_" + id);
80
    }
81
}
82