Skip to content

Commit 88b51de

Browse files
authored
Merge pull request #1060 from tmrpavan/tmrpavan-master
Sonar S4973 '==' and '!=' should not be used when 'equals' is overrid…
2 parents e0b86d0 + caa5789 commit 88b51de

6 files changed

Lines changed: 22 additions & 19 deletions

File tree

‎biojava-genome/src/main/java/org/biojava/nbio/genome/homology/GFF3FromUniprotBlastHits.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
140140
}
141141

142142
proteinIndex = proteinIndex + seq.length();
143-
if (startIndex != null && endIndex != null && startIndex != endIndex) {
143+
if (startIndex != null && endIndex != null && !startIndex.equals(endIndex)) {
144144
CDSSequence cdsSequence = cdsSequenceList.get(i);
145145
String hitLabel = "";
146146
if (transcriptSequence.getStrand() == Strand.POSITIVE) {

‎biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private boolean domainsAvailable() {
373373
return false;
374374

375375
// Re-download old copies of "latest"
376-
if(updateFrequency != null && requestedVersion == DEFAULT_VERSION ) {
376+
if(updateFrequency != null && requestedVersion.equals(DEFAULT_VERSION)) {
377377
long mod = f.lastModified();
378378
// Time of last update
379379
Date lastUpdate = new Date();

‎biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ private void formBondAltlocAware(Group g1, String name1, Group g2, String name2,
214214
for (Atom a1:a1s) {
215215
for (Atom a2:a2s) {
216216
if (a1.getAltLoc() != null && a2.getAltLoc()!=null &&
217-
a1.getAltLoc()!=' ' && a2.getAltLoc()!=' ' &&
218-
a1.getAltLoc() != a2.getAltLoc()) {
217+
!a1.getAltLoc().equals(' ') && !a2.getAltLoc().equals(' ') &&
218+
!a1.getAltLoc().equals(a2.getAltLoc())) {
219219
logger.debug("Skipping bond between atoms with differently named alt locs {} (altLoc '{}') -- {} (altLoc '{}')",
220220
a1.toString(), a1.getAltLoc(), a2.toString(), a2.getAltLoc());
221221
continue;

‎biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ private List<Integer> getPermutation(Matrix4d transformation) {
366366
int permutation = -1;
367367
double minDistSq = Double.MAX_VALUE;
368368
for (int j = 0; j < centers.size(); j++) {
369-
if (seqClusterId.get(i) == seqClusterId.get(j)) {
369+
if (Objects.equals(seqClusterId.get(i), seqClusterId.get(j))) {
370370
if (!used[j]) {
371371
double dSq = tCenter.distanceSquared(centers.get(j));
372372
if (dSq < minDistSq && dSq <= rmsdThresholdSq) {

‎biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/RotationSolver.java‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121

2222
package org.biojava.nbio.structure.symmetry.core;
2323

24-
import java.util.ArrayList;
25-
import java.util.HashMap;
26-
import java.util.HashSet;
27-
import java.util.List;
28-
import java.util.Map;
29-
import java.util.Set;
3024

3125
import javax.vecmath.AxisAngle4d;
3226
import javax.vecmath.Matrix4d;
@@ -40,6 +34,14 @@
4034
import org.biojava.nbio.structure.symmetry.geometry.DistanceBox;
4135
import org.biojava.nbio.structure.symmetry.geometry.SphereSampler;
4236

37+
import java.util.ArrayList;
38+
import java.util.HashMap;
39+
import java.util.HashSet;
40+
import java.util.List;
41+
import java.util.Map;
42+
import java.util.Objects;
43+
import java.util.Set;
44+
4345

4446
/**
4547
*
@@ -90,7 +92,7 @@ private void solve() {
9092
// isSpherical check added 08-04-11
9193
if (maxSymOps % 60 == 0 && isSpherical) {
9294
maxSymOps = 60;
93-
}
95+
}
9496

9597
AxisAngle4d sphereAngle = new AxisAngle4d();
9698
Matrix4d transformation = new Matrix4d();
@@ -122,7 +124,7 @@ private void solve() {
122124

123125
// get permutation of subunits and check validity/uniqueness
124126
List<Integer> permutation = getPermutation();
125-
// System.out.println("Rotation Solver: permutation: " + i + ": " + permutation);
127+
// System.out.println("Rotation Solver: permutation: " + i + ": " + permutation);
126128

127129
// check if novel
128130
if ( evaluatedPermutations.containsKey(permutation)) {
@@ -277,7 +279,7 @@ private List<Double> getAngles() {
277279
int n = subunits.getSubunitCount();
278280
// for spherical symmetric cases, n cannot be higher than 60
279281
if (n % 60 == 0 && isSpherical()) {
280-
n = 60;
282+
n = 60;
281283
}
282284
List<Integer> folds = subunits.getFolds();
283285
List<Double> angles = new ArrayList<Double>(folds.size()-1);
@@ -334,7 +336,7 @@ private boolean isAllowedPermutation(List<Integer> permutation) {
334336
int selfaligned = 0;
335337
for (int i = 0; i < permutation.size(); i++) {
336338
int j = permutation.get(i);
337-
if ( seqClusterId.get(i) != seqClusterId.get(j)) {
339+
if (!Objects.equals(seqClusterId.get(i), seqClusterId.get(j))) {
338340
return false;
339341
}
340342
if(i == j ) {
@@ -344,6 +346,7 @@ private boolean isAllowedPermutation(List<Integer> permutation) {
344346
// either identity (all self aligned) or all unique
345347
return selfaligned == 0 || selfaligned == permutation.size();
346348
}
349+
347350
/**
348351
* Adds translational component to rotation matrix
349352
* @param rotation
@@ -407,7 +410,7 @@ private List<Integer> getPermutation() {
407410
int closest = -1;
408411
double minDist = Double.MAX_VALUE;
409412

410-
for (int j : neighbors) {
413+
for (int j : neighbors) {
411414
double dist = t.distanceSquared(originalCoords[j]);
412415
if (dist < minDist) {
413416
closest = j;
@@ -417,7 +420,7 @@ private List<Integer> getPermutation() {
417420

418421
sum += minDist;
419422
if (closest == -1) {
420-
break;
423+
break;
421424
}
422425
permutation.add(closest);
423426
}

‎biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
import javax.vecmath.Point3d;
3131
import javax.vecmath.Quat4d;
3232
import javax.vecmath.Vector3d;
33-
3433
import java.util.ArrayList;
3534
import java.util.HashSet;
3635
import java.util.List;
36+
import java.util.Objects;
3737
import java.util.Set;
3838

3939

@@ -176,7 +176,7 @@ private boolean isAllowedPermuation(List<Integer> permutation) {
176176
List<Integer> seqClusterId = subunits.getClusterIds();
177177
for (int i = 0; i < permutation.size(); i++) {
178178
int j = permutation.get(i);
179-
if (seqClusterId.get(i) != seqClusterId.get(j)) {
179+
if (!Objects.equals(seqClusterId.get(i), seqClusterId.get(j))) {
180180
return false;
181181
}
182182
}

0 commit comments

Comments
 (0)