Debian Codegraph @

jna-inchi-api/src/main/java/io/github/dan2097/jnainchi/InchiRadical.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.tagINCHIRadical;
24
25 public enum InchiRadical {
26
27 NONE(tagINCHIRadical.INCHI_RADICAL_NONE),
28
29 SINGLET(tagINCHIRadical.INCHI_RADICAL_SINGLET),
30
31 DOUBLET(tagINCHIRadical.INCHI_RADICAL_DOUBLET),
32
33 TRIPLET(tagINCHIRadical.INCHI_RADICAL_TRIPLET);
34
35 private final byte code;
36
37 private InchiRadical(int code) {
38 this.code = (byte) code;
39 }
40
41 byte getCode() {
42 return code;
43 }
44
45 private static final Map<Byte, InchiRadical> map = new HashMap<>();
46
47 static {
48 for (InchiRadical val : InchiRadical.values()) {
49 map.put(val.code, val);
50 }
51 }
52
53 static InchiRadical of(byte code) {
54 return map.get(code);
55 }
56
57 }