Skip to content

Commit 837e844

Browse files
author
Mohamed Ezzat
committed
squid:S2178 - Short-circuit logic should be used in boolean contexts
1 parent 71b360d commit 837e844

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public List<AbstractSequence<? extends AbstractCompound>> getBioSequences() {
244244
*/
245245
public List<AbstractSequence<? extends AbstractCompound>> getBioSequences(boolean ignoreCase,
246246
String forcedSequenceType) {
247-
if (forcedSequenceType != null && !(forcedSequenceType.equals(PFAM) | forcedSequenceType.equals(RFAM))) {
247+
if (forcedSequenceType != null && !(forcedSequenceType.equals(PFAM) || forcedSequenceType.equals(RFAM))) {
248248
throw new IllegalArgumentException("Illegal Argument " + forcedSequenceType);
249249
}
250250
List<AbstractSequence<? extends AbstractCompound>> seqs = new ArrayList<AbstractSequence<? extends AbstractCompound>>();

biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/autosuggest/JAutoSuggest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void keyReleased(KeyEvent e) {
229229
list.ensureIndexIsVisible(list.getSelectedIndex() - 1);
230230
return;
231231
} else if (e.getKeyCode() == KeyEvent.VK_ENTER
232-
& list.getSelectedIndex() != -1 & suggestions.size() > 0) {
232+
&& list.getSelectedIndex() != -1 && suggestions.size() > 0) {
233233
setText((String) list.getSelectedValue());
234234

235235

biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ public String toMMCIF() {
666666

667667
str.append(SimpleMMcifParser.MMCIF_TOP_HEADER+"BioJava_mmCIF_file"+newline);
668668

669-
if (structure.getPDBHeader()!=null & structure.getPDBHeader().getCrystallographicInfo()!=null &&
669+
if (structure.getPDBHeader()!=null && structure.getPDBHeader().getCrystallographicInfo()!=null &&
670670
structure.getPDBHeader().getCrystallographicInfo().getSpaceGroup()!=null &&
671671
structure.getPDBHeader().getCrystallographicInfo().getCrystalCell()!=null) {
672672

biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ private void pdb_SITE_Handler(String line){
24312431
List<ResidueNumber> siteResidues = siteToResidueMap.get(siteID);
24322432

24332433
//if the siteResidues doesn't yet exist, make a new one.
2434-
if (siteResidues == null |! siteToResidueMap.containsKey(siteID.trim())){
2434+
if (siteResidues == null || ! siteToResidueMap.containsKey(siteID.trim())){
24352435
siteResidues = new ArrayList<ResidueNumber>();
24362436
siteToResidueMap.put(siteID.trim(), siteResidues);
24372437

biojava-structure/src/main/java/org/biojava/nbio/structure/jama/CholeskyDecomposition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public CholeskyDecomposition (Matrix Arg) {
8181
}
8282
Lrowj[k] = s = (A[j][k] - s)/L[k][k];
8383
d = d + s*s;
84-
isspd = isspd & (A[k][j] == A[j][k]);
84+
isspd = isspd && (A[k][j] == A[j][k]);
8585
}
8686
d = A[j][j] - d;
87-
isspd = isspd & (d > 0.0);
87+
isspd = isspd && (d > 0.0);
8888
L[j][j] = Math.sqrt(Math.max(d,0.0));
8989
for (int k = j+1; k < n; k++) {
9090
L[j][k] = 0.0;

biojava-structure/src/main/java/org/biojava/nbio/structure/jama/EigenvalueDecomposition.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ private void hqr2 () {
455455

456456
double norm = 0.0;
457457
for (int i = 0; i < nn; i++) {
458-
if (i < low | i > high) {
458+
if (i < low || i > high) {
459459
d[i] = H[i][i];
460460
e[i] = 0.0;
461461
}
@@ -820,7 +820,7 @@ private void hqr2 () {
820820
y = H[i+1][i];
821821
vr = (d[i] - p) * (d[i] - p) + e[i] * e[i] - q * q;
822822
vi = (d[i] - p) * 2.0 * q;
823-
if (vr == 0.0 & vi == 0.0) {
823+
if (vr == 0.0 && vi == 0.0) {
824824
vr = eps * norm * (Math.abs(w) + Math.abs(q) +
825825
Math.abs(x) + Math.abs(y) + Math.abs(z));
826826
}
@@ -854,7 +854,7 @@ private void hqr2 () {
854854
// Vectors of isolated roots
855855

856856
for (int i = 0; i < nn; i++) {
857-
if (i < low | i > high) {
857+
if (i < low || i > high) {
858858
for (int j = i; j < nn; j++) {
859859
V[i][j] = H[i][j];
860860
}
@@ -892,8 +892,8 @@ public EigenvalueDecomposition (Matrix Arg) {
892892
e = new double[n];
893893

894894
issymmetric = true;
895-
for (int j = 0; (j < n) & issymmetric; j++) {
896-
for (int i = 0; (i < n) & issymmetric; i++) {
895+
for (int j = 0; (j < n) && issymmetric; j++) {
896+
for (int i = 0; (i < n) && issymmetric; i++) {
897897
issymmetric = (A[i][j] == A[j][i]);
898898
}
899899
}

biojava-structure/src/main/java/org/biojava/nbio/structure/jama/LUDecomposition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public LUDecomposition (Matrix A) {
125125

126126
// Compute multipliers.
127127

128-
if (j < m & LU[j][j] != 0.0) {
128+
if (j < m && LU[j][j] != 0.0) {
129129
for (int i = j+1; i < m; i++) {
130130
LU[i][j] /= LU[j][j];
131131
}

biojava-structure/src/main/java/org/biojava/nbio/structure/jama/SingularValueDecomposition.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public SingularValueDecomposition (Matrix Arg) {
116116
s[k] = -s[k];
117117
}
118118
for (int j = k+1; j < n; j++) {
119-
if ((k < nct) & (s[k] != 0.0)) {
119+
if ((k < nct) && (s[k] != 0.0)) {
120120

121121
// Apply the transformation.
122122

@@ -135,7 +135,7 @@ public SingularValueDecomposition (Matrix Arg) {
135135

136136
e[j] = A[k][j];
137137
}
138-
if (wantu & (k < nct)) {
138+
if (wantu && (k < nct)) {
139139

140140
// Place the transformation in U for subsequent back
141141
// multiplication.
@@ -163,7 +163,7 @@ public SingularValueDecomposition (Matrix Arg) {
163163
e[k+1] += 1.0;
164164
}
165165
e[k] = -e[k];
166-
if ((k+1 < m) & (e[k] != 0.0)) {
166+
if ((k+1 < m) && (e[k] != 0.0)) {
167167

168168
// Apply the transformation.
169169

@@ -249,7 +249,7 @@ public SingularValueDecomposition (Matrix Arg) {
249249

250250
if (wantv) {
251251
for (int k = n-1; k >= 0; k--) {
252-
if ((k < nrt) & (e[k] != 0.0)) {
252+
if ((k < nrt) && (e[k] != 0.0)) {
253253
for (int j = k+1; j < nu; j++) {
254254
double t = 0;
255255
for (int i = k+1; i < n; i++) {
@@ -394,7 +394,7 @@ public SingularValueDecomposition (Matrix Arg) {
394394
double b = ((spm1 + sp)*(spm1 - sp) + epm1*epm1)/2.0;
395395
double c = (sp*epm1)*(sp*epm1);
396396
double shift = 0.0;
397-
if ((b != 0.0) | (c != 0.0)) {
397+
if ((b != 0.0) || (c != 0.0)) {
398398
shift = Math.sqrt(b*b + c);
399399
if (b < 0.0) {
400400
shift = -shift;

0 commit comments

Comments
 (0)