@@ -170,12 +170,12 @@ public class Canonizer {
170
170
private boolean [] mNitrogenQualifiesForParity ;
171
171
private ArrayList <CanonizerFragment > mFragmentList ;
172
172
private ArrayList <int []> mTHParityNormalizationGroupList ;
173
- private int mMode ,mNoOfRanks ,mNoOfPseudoGroups ;
173
+ private final int mMode ;
174
+ private int mNoOfRanks ,mNoOfPseudoGroups ;
174
175
private boolean mIsOddParityRound ;
175
- private boolean mZCoordinatesAvailable ,mAllHydrogensAreExplicit ;
176
+ private final boolean mZCoordinatesAvailable ,mAllHydrogensAreExplicit ;
176
177
private boolean mCIPParityNoDistinctionProblem ;
177
178
private boolean mEncodeAvoid127 ;
178
-
179
179
private boolean mGraphGenerated ;
180
180
private int mGraphRings ,mFeatureBlock ;
181
181
private int [] mGraphAtom ;
@@ -184,9 +184,10 @@ public class Canonizer {
184
184
private int [] mGraphFrom ;
185
185
private int [] mGraphClosure ;
186
186
187
- private String mIDCode , mEncodedCoords ,mMapping ;
188
- private StringBuilder mEncodingBuffer ;
189
- private int mEncodingBitsAvail ,mEncodingTempData ,mAtomBits ,mMaxConnAtoms ;
187
+ private String mIDCode , mEncodedCoords ,mMapping ;
188
+ private StringBuilder mEncodingBuffer ;
189
+ private int mEncodingBitsAvail ,mEncodingTempData ,mMaxConnAtoms ;
190
+ private final int mAtomBits ;
190
191
191
192
/**
192
193
* Runs a canonicalization procedure for the given molecule that creates unique atom ranks,
@@ -204,7 +205,7 @@ public Canonizer(StereoMolecule mol) {
204
205
* If mode includes ENCODE_ATOM_CUSTOM_LABELS, than custom atom labels are
205
206
* considered for the atom ranking and are encoded into the idcode.<br>
206
207
* If mode includes COORDS_ARE_3D, then getEncodedCoordinates() always returns
207
- * a 3D-encoding even if all z-coordinates are 0.0. Otherwise coordinates are
208
+ * a 3D-encoding even if all z-coordinates are 0.0. Otherwise, coordinates are
208
209
* encoded in 3D only, if at least one of the z-coords is not 0.0.
209
210
* @param mol
210
211
* @param mode 0 or one or more of CONSIDER...TOPICITY, CREATE..., ENCODE_ATOM_CUSTOM_LABELS, ASSIGN_PARITIES_TO_TETRAHEDRAL_N, COORDS_ARE_3D
@@ -226,17 +227,7 @@ public Canonizer(StereoMolecule mol, int mode) {
226
227
227
228
mZCoordinatesAvailable = ((mode & COORDS_ARE_3D ) != 0 ) || mMol .is3D ();
228
229
229
- mAllHydrogensAreExplicit = false ;
230
- if (mMol .getAllAtoms () > mMol .getAtoms ()
231
- && !mMol .isFragment ()) {
232
- mAllHydrogensAreExplicit = true ;
233
- for (int i =0 ; i <mMol .getAtoms (); i ++) {
234
- if (mMol .getImplicitHydrogens (i ) != 0 ) {
235
- mAllHydrogensAreExplicit = false ;
236
- break ;
237
- }
238
- }
239
- }
230
+ mAllHydrogensAreExplicit = (mMol .getImplicitHydrogens () == 0 );
240
231
241
232
if ((mMode & NEGLECT_ANY_STEREO_INFORMATION ) == 0 ) {
242
233
mTHParity = new byte [mMol .getAtoms ()];
@@ -639,7 +630,7 @@ private boolean canInnerBreakTiesByHeteroTopicity() {
639
630
private void canBreakTiesRandomly () {
640
631
for (int atom =0 ; atom <mMol .getAtoms (); atom ++) {
641
632
mCanBase [atom ].init (atom );
642
- mCanBase [atom ].add (mAtomBits +1 , 2 *mCanRank [atom ]);
633
+ mCanBase [atom ].add (mAtomBits +1 , ( long ) 2 *mCanRank [atom ]);
643
634
}
644
635
645
636
// promote randomly one atom of lowest shared rank.
@@ -895,7 +886,7 @@ private void canRecursivelyFindAllParities() {
895
886
thParityInfo |= mTHESRGroup [atom ];
896
887
}
897
888
898
- mCanBase [atom ].add (2 * parityInfoBits , thParityInfo << parityInfoBits ); // generate space for bond parity
889
+ mCanBase [atom ].add (2 * parityInfoBits , ( long ) thParityInfo << parityInfoBits ); // generate space for bond parity
899
890
}
900
891
901
892
for (int bond =0 ; bond <mMol .getBonds (); bond ++) {
@@ -3371,7 +3362,7 @@ public String getEncodedCoordinates() {
3371
3362
* original molecule including coordinates.<br>
3372
3363
* If keepPositionAndScale==false, then coordinate encoding will be relative,
3373
3364
* i.e. scale and absolute positions get lost during the encoding.
3374
- * Otherwise the encoding retains scale and absolute positions.<br>
3365
+ * Otherwise, the encoding retains scale and absolute positions.<br>
3375
3366
* If the molecule has 3D-coordinates and if there are no implicit hydrogen atoms,
3376
3367
* i.e. all hydrogen atoms are explicitly available with their coordinates, then
3377
3368
* hydrogen 3D-coordinates are also encoded despite the fact that the idcode itself does
0 commit comments