View Javadoc

1   /*
2    * Copyright 2006-2010 Sam Adams <sea36 at users.sourceforge.net>
3    *
4    * This file is part of JNI-InChI.
5    *
6    * JNI-InChI is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Lesser General Public License as published
8    * by the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * JNI-InChI is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public License
17   * along with JNI-InChI.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package net.sf.jniinchi;
20  
21  /**
22   * Enumeration of InChI 2D stereo definitions.
23   * Corresponds to <tt>inchi_BondStereo2D</tt> in <tt>inchi_api.h</tt>.
24   * @author Sam Adams
25   */
26  public enum INCHI_BOND_STEREO {
27  
28  
29      /**
30       * No 2D stereo definition recorded.
31       */
32      NONE(0),
33  
34      /**
35       * Stereocenter-related; positive: the sharp end points to this atom.
36       */
37      SINGLE_1UP(1),
38  
39      /**
40       * Stereocenter-related; positive: the sharp end points to this atom.
41       */
42      SINGLE_1EITHER(4),
43  
44      /**
45       * Stereocenter-related; positive: the sharp end points to this atom.
46       */
47      SINGLE_1DOWN(6),
48  
49      /**
50       * Stereocenter-related; negative: the sharp end points to the opposite atom.
51       */
52      SINGLE_2UP(-1),
53  
54      /**
55       * Stereocenter-related; negative: the sharp end points to the opposite atom.
56       */
57      SINGLE_2EITHER(-4),
58  
59      /**
60       * Stereocenter-related; negative: the sharp end points to the opposite atom.
61       */
62      SINGLE_2DOWN(-6),
63  
64      /**
65       * Unknown stereobond geometry.
66       */
67      DOUBLE_EITHER(3);
68  
69  
70  
71  
72      /**
73       * Internal InChI index (from inchi_api.h).
74       */
75      private final int indx;
76  
77      /**
78       * Constructor.
79       */
80      private INCHI_BOND_STEREO(final int indx) {
81          this.indx = indx;
82      }
83  
84      public int getIndx() {
85          return indx;
86      }
87  
88  
89      public static INCHI_BOND_STEREO getValue(int bster) {
90          switch (bster) {
91              case 0:
92                  return NONE;
93              case 1:
94                  return SINGLE_1UP;
95              case 4:
96                  return SINGLE_1EITHER;
97              case 6:
98                  return SINGLE_1DOWN;
99              case 3:
100                 return DOUBLE_EITHER;
101             case -1:
102                 return SINGLE_2UP;
103             case -4:
104                 return SINGLE_2EITHER;
105             case -6:
106                 return SINGLE_2DOWN;
107             default:
108                 return null;
109         }
110     }
111     
112 }