Debian Codegraph @

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