pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/biojava/biojava/commit/0af196ffd522f98aa093dd569659438f1ab81ebf

="stylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> Fix RSPEC-1940 boolean checks · biojava/biojava@0af196f · GitHub
Skip to content

Commit 0af196f

Browse files
author
JasonKamsu
committed
Fix RSPEC-1940 boolean checks
1 parent 94c6ebc commit 0af196f

9 files changed

Lines changed: 25 additions & 11 deletions

File tree

biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/InsdcParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ private List<Location> parseLocationString(String string, int versus) {
260260
l.setPartialOn3prime(true);
261261
}
262262

263-
if (!(accession == null || "".equals(accession))) l.setAccession(new AccessionID(accession));
263+
if (accession != null && !"".equals(accession)) {
264+
l.setAccession(new AccessionID(accession));
265+
}
264266

265267
boundedLocationsCollection.add(l);
266268

biojava-core/src/main/java/org/biojava/nbio/core/util/Equals.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ public static boolean equal(boolean one, boolean two) {
4949
* @see #classEqual(Object, Object)
5050
*/
5151
public static boolean equal(Object one, Object two) {
52-
return one == null && two == null || !(one == null || two == null) && (one == two || one.equals(two));
52+
if (one == two) {
53+
return true;
54+
}
55+
if (one == null || two == null) {
56+
return false;
57+
}
58+
return one.equals(two);
5359
}
5460

5561
/**
@@ -84,6 +90,12 @@ public static boolean equal(Object one, Object two) {
8490
* equal at the class level
8591
*/
8692
public static boolean classEqual(Object one, Object two) {
87-
return one == two || !(one == null || two == null) && one.getClass() == two.getClass();
93+
if (one == two) {
94+
return true;
95+
}
96+
if (one == null || two == null) {
97+
return false;
98+
}
99+
return one.getClass() == two.getClass();
88100
}
89101
}

biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static Location fromBio( int start, int end, char strand )
135135
int s= start - 1;
136136
int e= end;
137137

138-
if( !( strand == '-' || strand == '+' || strand == '.' ))
138+
if( strand != '-' && strand != '+' && strand != '.' )
139139
{
140140
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
141141
}
@@ -166,7 +166,7 @@ public static Location fromBioExt( int start, int length, char strand, int total
166166
int s= start;
167167
int e= s + length;
168168

169-
if( !( strand == '-' || strand == '+' || strand == '.' ))
169+
if( strand != '-' && strand != '+' && strand != '.' )
170170
{
171171
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
172172
}

biojava-structure/src/main/java/org/biojava/nbio/structure/Author.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public boolean equals(Object obj) {
6262
if ((this.surname == null) ? (other.surname != null) : !this.surname.equals(other.surname)) {
6363
return false;
6464
}
65-
return !((this.initials == null) ? (other.initials != null) : !this.initials.equals(other.initials));
65+
return (this.initials == null) ? other.initials == null : this.initials.equals(other.initials);
6666
}
6767

6868
@Override

biojava-structure/src/main/java/org/biojava/nbio/structure/Element.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public boolean isHeavyAtom() {
424424
* @return <CODE>true</CODE> if Element is not Hydrogen and not Carbon.
425425
*/
426426
public boolean isHeteroAtom() {
427-
return !(this == C || this == H);
427+
return this != C && this != H;
428428
}
429429

430430
/**

biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CECalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str
14501450
//afpChain.setTotalRmsdOpt(rmsd);
14511451
//System.out.println("rmsd: " + rmsd);
14521452

1453-
if(!(nAtom<strLen*0.95) && (!isRmsdLenAssigned)) {
1453+
if(nAtom >= strLen * 0.95 && !isRmsdLenAssigned) {
14541454
rmsdLen=rmsd;
14551455
isRmsdLenAssigned=true;
14561456
}

biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCalculatorEnhanced.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ private int optimizeSuperposition(AFPChain afpChain, int nse1, int nse2, int str
14551455
//afpChain.setTotalRmsdOpt(rmsd);
14561456
//System.out.println("rmsd: " + rmsd);
14571457

1458-
if(!(nAtom<strLen*0.95) && (!isRmsdLenAssigned)) {
1458+
if(nAtom >= strLen * 0.95 && !isRmsdLenAssigned) {
14591459
rmsdLen=rmsd;
14601460
isRmsdLenAssigned=true;
14611461
}

biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static boolean isUnaryExpression(String expression) {
5555
if (first < 0 || last < 0) {
5656
return true;
5757
}
58-
return ! (first == 0 && last > first);
58+
return first != 0 || last <= first;
5959
}
6060

6161
public static List<String> parseUnaryOperatorExpression(String operatorExpression) {

biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static List<SecStrucInfo> getSecStrucInfo(Structure s) {
5757
Group g = iter.next();
5858
if (g.hasAminoAtoms()) {
5959
Object p = g.getProperty(Group.SEC_STRUC);
60-
if (!(p == null)) {
60+
if (p != null) {
6161
SecStrucInfo ss = (SecStrucInfo) p;
6262
listSSI.add(ss);
6363
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy