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/c0240dd9d192d2ed3df5bab95830016bc9215133

stylesheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> Refactor: fix SonarQube S1155 issues (#1079) · biojava/biojava@c0240dd · GitHub
Skip to content

Commit c0240dd

Browse files
committed
Refactor: fix SonarQube S1155 issues (#1079)
1 parent 51f48cd commit c0240dd

39 files changed

Lines changed: 80 additions & 82 deletions

File tree

biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ so it should be done here (manualy).
162162
logger.info("taxonomy name '{}'", taxonName);
163163
Assert.assertNotNull(taxonName);
164164

165-
if (seq.getFeaturesByType("CDS").size() > 0) {
165+
if (!seq.getFeaturesByType("CDS").isEmpty()) {
166166
FeatureInterface<AbstractSequence<AminoAcidCompound>, AminoAcidCompound> CDS = seq.getFeaturesByType("CDS").get(0);
167167
logger.info("CDS: {}", CDS);
168168
String codedBy = CDS.getQualifiers().get("coded_by").get(0).getValue();

biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
/**
3838
*
39-
* @author Scooter Willis
39+
* @author Scooter Willis
4040
*/
4141
public class GeneFeatureHelper {
4242

@@ -418,7 +418,7 @@ static public void addGmodGFF3GeneFeatures(Map<String, ChromosomeSequence> chrom
418418
String startCodonName = "";
419419
String stopCodonName = "";
420420
FeatureList startCodonList = mRNAChildren.selectByType("five_prime_UTR");
421-
if (startCodonList != null && startCodonList.size() > 0) {
421+
if (startCodonList != null && !startCodonList.isEmpty()) {
422422
startCodon = startCodonList.get(0);
423423
if (strand == Strand.NEGATIVE) {
424424
startCodonBegin = startCodon.location().bioEnd();
@@ -430,7 +430,7 @@ static public void addGmodGFF3GeneFeatures(Map<String, ChromosomeSequence> chrom
430430

431431
FeatureList stopCodonList = mRNAChildren.selectByType("three_prime_UTR");
432432

433-
if (stopCodonList != null && stopCodonList.size() > 0) {
433+
if (stopCodonList != null && !stopCodonList.isEmpty()) {
434434
stopCodon = stopCodonList.get(0);
435435
if (strand == Strand.NEGATIVE) {
436436
stopCodonEnd = stopCodon.location().bioStart();
@@ -577,7 +577,7 @@ static public void addGlimmerGFF3GeneFeatures(Map<String, ChromosomeSequence> ch
577577
String startCodonName = "";
578578
String stopCodonName = "";
579579
FeatureList startCodonList = gene.selectByAttribute("Note", "initial-exon");
580-
if (startCodonList != null && startCodonList.size() > 0) {
580+
if (startCodonList != null && !startCodonList.isEmpty()) {
581581
startCodon = startCodonList.get(0);
582582
if (strand == Strand.NEGATIVE) {
583583
startCodonBegin = startCodon.location().bioEnd();
@@ -589,7 +589,7 @@ static public void addGlimmerGFF3GeneFeatures(Map<String, ChromosomeSequence> ch
589589

590590
FeatureList stopCodonList = gene.selectByAttribute("Note", "final-exon");
591591

592-
if (stopCodonList != null && stopCodonList.size() > 0) {
592+
if (stopCodonList != null && !stopCodonList.isEmpty()) {
593593
stopCodon = stopCodonList.get(0);
594594
if (strand == Strand.NEGATIVE) {
595595
stopCodonEnd = stopCodon.location().bioStart();
@@ -723,7 +723,7 @@ static public void addGeneMarkGTFGeneFeatures(Map<String, ChromosomeSequence> ch
723723
String startCodonName = "";
724724
String stopCodonName = "";
725725
FeatureList startCodonList = transcriptFeature.selectByType("start_codon");
726-
if (startCodonList != null && startCodonList.size() > 0) {
726+
if (startCodonList != null && !startCodonList.isEmpty()) {
727727
startCodon = startCodonList.get(0);
728728
if (strand == Strand.POSITIVE) {
729729
startCodonBegin = startCodon.location().bioStart();
@@ -735,7 +735,7 @@ static public void addGeneMarkGTFGeneFeatures(Map<String, ChromosomeSequence> ch
735735

736736
FeatureList stopCodonList = transcriptFeature.selectByType("stop_codon");
737737

738-
if (stopCodonList != null && stopCodonList.size() > 0) {
738+
if (stopCodonList != null && !stopCodonList.isEmpty()) {
739739
stopCodon = stopCodonList.get(0);
740740
if (strand == Strand.POSITIVE) {
741741
stopCodonEnd = stopCodon.location().bioEnd();

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
/**
4848
*
49-
* @author Scooter Willis
49+
* @author Scooter Willis
5050
* @author Mark Chapman
5151
*/
5252
public class GFF3FromUniprotBlastHits {
@@ -163,7 +163,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
163163
String notes = "";
164164
if (featureKeyWords != null) {
165165
List<String> keyWords = featureKeyWords.getKeyWords();
166-
if (keyWords.size() > 0) {
166+
if (!keyWords.isEmpty()) {
167167
notes = ";Note=";
168168
for (String note : keyWords) {
169169
if ("Complete proteome".equals(note)) {
@@ -187,7 +187,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
187187
List<DBReferenceInfo> cazyList = databaseReferenceHashMap.get("CAZy");
188188
List<DBReferenceInfo> goList = databaseReferenceHashMap.get("GO");
189189
List<DBReferenceInfo> eccList = databaseReferenceHashMap.get("BRENDA");
190-
if (pfamList != null && pfamList.size() > 0) {
190+
if (pfamList != null && !pfamList.isEmpty()) {
191191
if (notes.length() == 0) {
192192
notes = ";Note=";
193193
}
@@ -197,7 +197,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
197197
}
198198
}
199199

200-
if (cazyList != null && cazyList.size() > 0) {
200+
if (cazyList != null && !cazyList.isEmpty()) {
201201
if (notes.length() == 0) {
202202
notes = ";Note=";
203203
}
@@ -208,7 +208,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
208208
}
209209
}
210210

211-
if (eccList != null && eccList.size() > 0) {
211+
if (eccList != null && !eccList.isEmpty()) {
212212
if (notes.length() == 0) {
213213
notes = ";Note=";
214214
}
@@ -221,8 +221,8 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
221221
}
222222
}
223223

224-
if (goList != null && goList.size() > 0) {
225-
if (notes.length() == 0) {
224+
if (goList != null && !goList.isEmpty()) {
225+
if (notes.isEmpty()) {
226226
notes = ";Note=";
227227
}
228228
for (DBReferenceInfo note : goList) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
/**
3333
*
34-
* @author Scooter Willis
34+
* @author Scooter Willis
3535
*/
3636
public class GFF3Writer {
3737

@@ -122,7 +122,7 @@ public void write(OutputStream outputStream, Map<String, ChromosomeSequence> chr
122122
private String getGFF3Note(List<String> notesList) {
123123
String notes = "";
124124

125-
if (notesList.size() > 0) {
125+
if (!notesList.isEmpty()) {
126126
notes = ";Note=";
127127
int noteindex = 1;
128128
for (String note : notesList) {

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestSeqResParsing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void test11GS() throws IOException, StructureException{
5353

5454
s = StructureIO.getStructure(pdbID);
5555
assertNotNull(s);
56-
assertTrue(s.getChains().size() > 0);
56+
assertFalse(s.getChains().isEmpty());
5757
Chain c = s.getChainByIndex(0);
5858

5959
assertTrue(c.getSeqResGroups().size() > 2);

biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ModifiedCompoundXMLConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static String toXML(ModifiedCompound mc) throws IOException{
6969

7070

7171
Set<StructureAtomLinkage > linkages = mc.getAtomLinkages();
72-
if ( linkages.size() > 0 ) {
72+
if (!linkages.isEmpty()) {
7373
int pos = -1;
7474
for ( StructureAtomLinkage link: linkages){
7575
pos ++;

biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public void identify(final List<Chain> chains,
285285

286286
if (residues.isEmpty()) {
287287
String pdbId = "?";
288-
if ( chains.size() > 0) {
288+
if (!chains.isEmpty()) {
289289
Structure struc = chains.get(0).getStructure();
290290
if ( struc != null)
291291
pdbId = struc.getPDBCode();

biojava-modfinder/src/test/java/org/biojava/nbio/protmod/phosphosite/TestAcetylation.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
import java.net.URL;
3333
import java.util.List;
3434

35-
import static org.junit.Assert.assertTrue;
35+
import static org.junit.Assert.assertFalse;
36+
import static org.junit.Assert.assertNotNull;
3637
import static org.junit.Assert.fail;
3738

3839

@@ -100,11 +101,11 @@ public void testAcetylation() throws IOException {
100101

101102
List<Site> sites = Site.parseSites(localFile);
102103

103-
assertTrue(sites.size() > 0);
104+
assertFalse(sites.isEmpty());
104105

105106
for (Site s : sites) {
106107

107-
assertTrue(s.getResidue() != null);
108+
assertNotNull(s.getResidue());
108109

109110
}
110111

biojava-ontology/src/main/java/org/biojava/nbio/ontology/utils/WeakValueHashMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public WeakValueHashMap() {
5858
private void diddleReferenceQueue() {
5959
// Avoid making behind-the-scenes modifications while iterators exist.
6060

61-
if (iteratorRefs.size() > 0) {
61+
if (!iteratorRefs.isEmpty()) {
6262
Reference ref;
6363
while ((ref = iteratorRefQueue.poll()) != null) {
6464
iteratorRefs.remove(ref);
6565
}
66-
if (iteratorRefs.size() > 0) {
66+
if (!iteratorRefs.isEmpty()) {
6767
return;
6868
}
6969
}

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

Lines changed: 2 additions & 2 deletions
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.isEmpty()) {
233233
setText((String) list.getSelectedValue());
234234

235235

@@ -365,7 +365,7 @@ public String doInBackground() {
365365

366366
setFont(regular);
367367

368-
if (suggestions.size() > 0) {
368+
if (!suggestions.isEmpty()) {
369369
list.setListData(suggestions);
370370
list.setSelectedIndex(0);
371371
list.ensureIndexIsVisible(0);

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