Skip to content

Commit

Permalink
Correct boolean comparison
Browse files Browse the repository at this point in the history
Change-Id: I0a4f1eb2e97403089d046e5ab2dad22676c98256
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
egonw authored and johnmay committed May 3, 2013
1 parent 5753c24 commit 352f1d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ private IAtomType perceivePhosphors(IAtomContainer atomContainer, IAtom atom)
}
} else if (neighborcount == 3) {
int doubleBonds = countAttachedDoubleBonds(atomContainer, atom);
if (atom.getFormalCharge() != null &
if (atom.getFormalCharge() != null &&
atom.getFormalCharge().intValue() == 1) {
IAtomType type = getAtomType("P.anium");
if (isAcceptable(atom, atomContainer, type)) return type;
Expand All @@ -1355,7 +1355,7 @@ private IAtomType perceivePhosphors(IAtomContainer atomContainer, IAtom atom)
}
} else if (neighborcount == 2) {
if (maxBondOrder == CDKConstants.BONDORDER_DOUBLE) {
if (atom.getFormalCharge() != null &
if (atom.getFormalCharge() != null &&
atom.getFormalCharge().intValue() == 1) {
IAtomType type = getAtomType("P.sp1.plus");
if (isAcceptable(atom, atomContainer, type)) return type;
Expand Down
12 changes: 6 additions & 6 deletions src/main/org/openscience/cdk/atomtype/MM2AtomTypeMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atomIn
}
p1 = Pattern.compile(getSphericalMatcher("OX"));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="OX";
}

Expand All @@ -216,12 +216,12 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atomIn
//Amid
p1 = Pattern.compile(getSphericalMatcher("Namid"));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="Nsp2";
}else{
p1 = Pattern.compile(getSphericalMatcher("N2OX"));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="N2OX";
}
}
Expand All @@ -235,7 +235,7 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atomIn
//Azo
p1 = Pattern.compile(getSphericalMatcher("-N="));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="-N=";
}else{
p1 = Pattern.compile(getSphericalMatcher("N=C"));
Expand Down Expand Up @@ -273,13 +273,13 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atomIn
//Enol,amid
p1 = Pattern.compile(getSphericalMatcher("HOC"));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="HN2";
}
//COOH
p1 = Pattern.compile(getSphericalMatcher("HOCO"));
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemicalGroupConstant==-1) {
if (mat1.matches() && atomChemicalGroupConstant==-1) {
ID="HOCO";
}
} else if (atomTypeIds[j].equals("HN")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atomIn
//Amid
p1 = Pattern.compile(getSphericalMatcher(atomTypeIds[48]));//NC=0
mat1 = p1.matcher(atomSphericalMatcher);
if (mat1.matches() & atomChemGroupConstant==-1) {
if (mat1.matches() && atomChemGroupConstant==-1) {
ID = atomTypeIds[48];//NC=O
}
//nsp3 oxide
Expand Down

0 comments on commit 352f1d5

Please sign in to comment.