Debian Codegraph @

jna-inchi-api/src/main/java/io/github/dan2097/jnainchi/InchiCheckStatus.java

raw
1 /**
2 * JNA-InChI - Library for calling InChI from Java
3 * Copyright © 2018 Daniel Lowe
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 package io.github.dan2097.jnainchi;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import io.github.dan2097.jnainchi.inchi.InchiLibrary.tagRetValCheckINCHI;
24
25 public enum InchiCheckStatus {
26
27 VALID_STANDARD(tagRetValCheckINCHI.INCHI_VALID_STANDARD),
28 VALID_NON_STANDARD(tagRetValCheckINCHI.INCHI_VALID_NON_STANDARD),
29 VALID_BETA(tagRetValCheckINCHI.INCHI_VALID_BETA),
30 INVALID_PREFIX(tagRetValCheckINCHI.INCHI_INVALID_PREFIX),
31 INVALID_VERSION(tagRetValCheckINCHI.INCHI_INVALID_VERSION),
32 INVALID_LAYOUT(tagRetValCheckINCHI.INCHI_INVALID_LAYOUT),
33 FAIL_I2I(tagRetValCheckINCHI.INCHI_FAIL_I2I);
34
35 private final int code;
36
37 private InchiCheckStatus(int code){
38 this.code = code;
39 }
40
41 private static final Map<Integer, InchiCheckStatus> map = new HashMap<>();
42
43 static {
44 for (InchiCheckStatus val : InchiCheckStatus.values()) {
45 map.put(val.code, val);
46 }
47 }
48
49 static InchiCheckStatus of(int code) {
50 return map.get(code);
51 }
52
53 }