Debian Codegraph @

jna-inchi-api/src/main/java/io/github/dan2097/jnainchi/InchiKeyCheckStatus.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.tagRetValGetINCHIKey;
24
25 public enum InchiKeyCheckStatus {
26
27 VALID_STANDARD(tagRetValGetINCHIKey.INCHIKEY_VALID_STANDARD),
28 VALID_NON_STANDARD(tagRetValGetINCHIKey.INCHIKEY_VALID_NON_STANDARD),
29 INVALID_LENGTH(tagRetValGetINCHIKey.INCHIKEY_INVALID_LENGTH),
30 INVALID_LAYOUT(tagRetValGetINCHIKey.INCHIKEY_INVALID_LAYOUT),
31 INVALID_VERSION(tagRetValGetINCHIKey.INCHIKEY_INVALID_VERSION);
32
33 private final int code;
34
35 private InchiKeyCheckStatus(int code){
36 this.code = code;
37 }
38
39 private static final Map<Integer, InchiKeyCheckStatus> map = new HashMap<>();
40
41 static {
42 for (InchiKeyCheckStatus val : InchiKeyCheckStatus.values()) {
43 map.put(val.code, val);
44 }
45 }
46
47 static InchiKeyCheckStatus of(int code) {
48 return map.get(code);
49 }
50
51 }