Skip to content

Commit fb30b9a

Browse files
committed
Simplified boolean expressions.
git-svn-id: http://code.open-bio.org/repos/biojava/biojava-live/trunk@9503 7c6358e6-4a41-0410-a743-a5b2a554c398
1 parent 55f64dc commit fb30b9a

18 files changed

Lines changed: 33 additions & 33 deletions

File tree

biojava3-aa-prop/src/main/java/org/biojava3/aaproperties/PeptidePropertiesImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public double getMolecularWeight(ProteinSequence sequence) {
6666
@Override
6767
public double getMolecularWeight(ProteinSequence sequence, File aminoAcidCompositionFile) throws JAXBException, FileNotFoundException {
6868
File elementMassFile = new File("./src/main/resources/ElementMass.xml");
69-
if(elementMassFile.exists() == false){
69+
if(!elementMassFile.exists()){
7070
throw new FileNotFoundException("Cannot locate ElementMass.xml. " +
7171
"Please use getMolecularWeight(ProteinSequence, File, File) to specify ElementMass.xml location.");
7272
}
@@ -99,7 +99,7 @@ public double getMolecularWeightBasedOnXML(ProteinSequence sequence, AminoAcidCo
9999
public AminoAcidCompositionTable obtainAminoAcidCompositionTable(File aminoAcidCompositionFile)
100100
throws JAXBException, FileNotFoundException{
101101
File elementMassFile = new File("./src/main/resources/ElementMass.xml");
102-
if(elementMassFile.exists() == false){
102+
if(!elementMassFile.exists()){
103103
throw new FileNotFoundException("Cannot locate ElementMass.xml. " +
104104
"Please use getMolecularWeight(ProteinSequence, File, File) to specify ElementMass.xml location.");
105105
}
@@ -140,7 +140,7 @@ public double getExtinctionCoefficient(ProteinSequence sequence, boolean assumeC
140140
Map<AminoAcidCompound, Integer> extinctAA2Count = this.getExtinctAACount(sequence);
141141

142142
double eProt;
143-
if(assumeCysReduced == false){
143+
if(!assumeCysReduced){
144144
eProt = extinctAA2Count.get(aaSet.getCompoundForString("Y")) *
145145
Constraints.aa2ExtinctionCoefficient.get(aaSet.getCompoundForString("Y")) +
146146
extinctAA2Count.get(aaSet.getCompoundForString("W")) *

biojava3-aa-prop/src/main/java/org/biojava3/aaproperties/Utils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public final static double roundToDecimals(double d, int c) {
4444
*/
4545
public final static boolean doesSequenceContainInvalidChar(String sequence, Set<Character> cSet){
4646
for(char c:sequence.toCharArray()){
47-
if(cSet.contains(c) == false) return true;
47+
if(!cSet.contains(c)) return true;
4848
}
4949
return false;
5050
}
@@ -68,7 +68,7 @@ public final static int getNumberOfInvalidChar(String sequence, Set<Character> c
6868
else cArray = sequence.toCharArray();
6969
if(cSet == null) cSet = PeptideProperties.standardAASet;
7070
for(char c:cArray){
71-
if(cSet.contains(c) == false) total++;
71+
if(!cSet.contains(c)) total++;
7272
}
7373
return total;
7474
}
@@ -89,7 +89,7 @@ public final static String cleanSequence(String sequence, Set<Character> cSet){
8989
String cleanSeq = "";
9090
if(cSet == null) cSet = PeptideProperties.standardAASet;
9191
for(char c:sequence.toCharArray()){
92-
if(cSet.contains(c) == false){
92+
if(!cSet.contains(c)){
9393
cleanSeq += "-";
9494
invalidCharSet.add(c);
9595
}else{

biojava3-aa-prop/src/main/java/org/biojava3/aaproperties/xml/CaseFreeAminoAcidCompoundSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static CaseFreeAminoAcidCompoundSet getAminoAcidCompoundSet() {
128128

129129
public boolean compoundsEquivalent(AminoAcidCompound compoundOne, AminoAcidCompound compoundTwo) {
130130
Set<AminoAcidCompound> equivalents = getEquivalentCompounds(compoundOne);
131-
return (equivalents == null) ? false : equivalents.contains(compoundTwo);
131+
return (equivalents != null) && equivalents.contains(compoundTwo);
132132
}
133133

134134
public Set<AminoAcidCompound> getEquivalentCompounds(AminoAcidCompound compound) {

biojava3-core/src/main/java/org/biojava3/core/sequence/compound/AminoAcidCompoundSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static AminoAcidCompoundSet getAminoAcidCompoundSet() {
133133

134134
public boolean compoundsEquivalent(AminoAcidCompound compoundOne, AminoAcidCompound compoundTwo) {
135135
Set<AminoAcidCompound> equivalents = getEquivalentCompounds(compoundOne);
136-
return (equivalents == null) ? false : equivalents.contains(compoundTwo);
136+
return (equivalents != null) && equivalents.contains(compoundTwo);
137137
}
138138

139139
public Set<AminoAcidCompound> getEquivalentCompounds(AminoAcidCompound compound) {

biojava3-core/src/main/java/org/biojava3/core/sequence/io/FastaReaderHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class FastaReaderHelper {
4949
* @throws Exception
5050
*/
5151
public static LinkedHashMap<String, DNASequence> readFastaDNASequence(File file, boolean lazySequenceLoad) throws Exception {
52-
if (lazySequenceLoad == false) {
52+
if (!lazySequenceLoad) {
5353
return readFastaDNASequence(file);
5454
}
5555

biojava3-core/src/main/java/org/biojava3/core/sequence/io/GenericFastaHeaderParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private String[] getHeaderValues(String header) {
7676
// System.out.println("accession=" + data[0]);
7777
// return data;
7878
//} else
79-
if (header.startsWith("PDB:") == false) {
79+
if (!header.startsWith("PDB:")) {
8080
for (int i = 0; i < header.length(); i++) {
8181
if (header.charAt(i) == '|') {
8282
values.add(sb.toString());

biojava3-core/src/main/java/org/biojava3/core/sequence/loader/SequenceFileProxyLoader.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public int getLength() {
148148
* @return
149149
*/
150150
public C getCompoundAt(int position) {
151-
if (this.isInitialized() == false) {
151+
if (!this.isInitialized()) {
152152
init();
153153
}
154154
return this.parsedCompounds.get(position - 1);
@@ -160,7 +160,7 @@ public C getCompoundAt(int position) {
160160
* @return
161161
*/
162162
public int getIndexOf(C compound) {
163-
if (this.isInitialized() == false) {
163+
if (!this.isInitialized()) {
164164
init();
165165
}
166166
return this.parsedCompounds.indexOf(compound) + 1;
@@ -172,7 +172,7 @@ public int getIndexOf(C compound) {
172172
* @return
173173
*/
174174
public int getLastIndexOf(C compound) {
175-
if (this.isInitialized() == false) {
175+
if (!this.isInitialized()) {
176176
init();
177177
}
178178
return this.parsedCompounds.lastIndexOf(compound) + 1;
@@ -183,7 +183,7 @@ public int getLastIndexOf(C compound) {
183183
* @return
184184
*/
185185
public String toString() {
186-
if (this.isInitialized() == false) {
186+
if (!this.isInitialized()) {
187187
init();
188188
}
189189
return getSequenceAsString();
@@ -206,7 +206,7 @@ public String getSequenceAsString() {
206206
*/
207207
public String getSequenceAsString(Integer bioBegin, Integer bioEnd, Strand strand) {
208208

209-
if (this.isInitialized() == false) {
209+
if (!this.isInitialized()) {
210210
init();
211211
}
212212
SequenceAsStringHelper<C> sequenceAsStringHelper = new SequenceAsStringHelper<C>();
@@ -218,7 +218,7 @@ public String getSequenceAsString(Integer bioBegin, Integer bioEnd, Strand stran
218218
* @return
219219
*/
220220
public List<C> getAsList() {
221-
if (this.isInitialized() == false) {
221+
if (!this.isInitialized()) {
222222
init();
223223
}
224224
return this.parsedCompounds;
@@ -232,7 +232,7 @@ public List<C> getAsList() {
232232
* @return
233233
*/
234234
public SequenceView<C> getSubSequence(final Integer bioBegin, final Integer bioEnd) {
235-
if (this.isInitialized() == false) {
235+
if (!this.isInitialized()) {
236236
init();
237237
}
238238
return new SequenceProxyView<C>(SequenceFileProxyLoader.this, bioBegin, bioEnd);
@@ -243,7 +243,7 @@ public SequenceView<C> getSubSequence(final Integer bioBegin, final Integer bioE
243243
* @return
244244
*/
245245
public Iterator<C> iterator() {
246-
if (this.isInitialized() == false) {
246+
if (!this.isInitialized()) {
247247
init();
248248
}
249249
return this.parsedCompounds.iterator();

biojava3-core/src/main/java/org/biojava3/core/sequence/loader/UniprotProxySequenceReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public static String getUniprotDirectoryCache() {
375375
*/
376376
public static void setUniprotDirectoryCache(String aUniprotDirectoryCache) {
377377
File f = new File(aUniprotDirectoryCache);
378-
if (f.exists() == false) {
378+
if (!f.exists()) {
379379
f.mkdirs();
380380
}
381381
uniprotDirectoryCache = aUniprotDirectoryCache;

biojava3-core/src/main/java/org/biojava3/core/util/PrettyXMLWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void declareNamespace(String nsURI, String prefixHint)
5959
throws IOException
6060
{
6161
if (!namespacePrefixes.containsKey(nsURI)) {
62-
if (isOpeningTag == true) {
62+
if (isOpeningTag) {
6363
String prefix = allocPrefix(nsURI);
6464
attribute("xmlns:" + prefix, nsURI);
6565
} else {

biojava3-genome/src/main/java/org/biojava3/genome/homology/GFF3FromUniprotBlastHits.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void process(LinkedHashMap<String, ArrayList<String>> hits, LinkedHashMap
8383
for (ProteinSequence cdsProteinSequence : cdsProteinList) {
8484
testSequence = testSequence + cdsProteinSequence.getSequenceAsString();
8585
}
86-
if (testSequence.equals(predictedProteinSequence) == false && (predictedProteinSequence.equals(testSequence.substring(0, testSequence.length() - 1)) == false)) {
86+
if (!testSequence.equals(predictedProteinSequence) && (!predictedProteinSequence.equals(testSequence.substring(0, testSequence.length() - 1)))) {
8787
DNASequence codingSequence = transcriptSequence.getDNACodingSequence();
8888
System.out.println(codingSequence.getSequenceAsString());
8989
System.out.println("Sequence agreement error");

0 commit comments

Comments
 (0)