JAL-1819 use Float.isNaN() to check for NaNs!
authorJim Procter <jprocter@issues.jalview.org>
Thu, 23 Jul 2015 10:26:11 +0000 (11:26 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 23 Jul 2015 10:26:11 +0000 (11:26 +0100)
src/jalview/analysis/AlignmentSorter.java
src/jalview/appletgui/IdPanel.java
src/jalview/datamodel/Annotation.java
src/jalview/io/AnnotationFile.java
src/jalview/io/FeaturesFile.java
src/jalview/io/SequenceAnnotationReport.java
src/jalview/io/vamsas/Sequencefeature.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/schemes/GraduatedColor.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
src/jalview/ws/jws2/AADisorderClient.java

index 2fad332..0022af6 100755 (executable)
@@ -820,7 +820,7 @@ public class AlignmentSorter
         else
         {
           // or, also take a look at the scores if necessary.
-          if (!ignoreScore && sf[f].getScore() != Float.NaN)
+          if (!ignoreScore && !Float.isNaN(sf[f].getScore()))
           {
             if (seqScores[i] == 0)
             {
index 258b8b6..72f94ec 100755 (executable)
@@ -142,7 +142,7 @@ public class IdPanel extends Panel implements MouseListener,
             nl = true;
           }
           ;
-          if (sf[sl].getScore() != Float.NaN && sf[sl].getScore() != 0f)
+          if (!Float.isNaN(sf[sl].getScore()) && sf[sl].getScore() != 0f)
           {
             tooltiptext.append(" Score = ");
             tooltiptext.append(sf[sl].getScore());
index dae81ef..0230e7a 100755 (executable)
@@ -168,7 +168,7 @@ public class Annotation
     {
       sb.append(",");
     }
-    if (value != Float.NaN)
+    if (!Float.isNaN(value))
     {
       sb.append(value);
     }
index 88cb46e..937826a 100755 (executable)
@@ -241,7 +241,7 @@ public class AnnotationFile
                     && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter
                     .equals(" "));
             hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');
-            hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't
+            hasValues |= (!Float.isNaN(row.annotations[j].value)); // NaNs can't
             // be
             // rendered..
             hasText |= (row.annotations[j].description != null && row.annotations[j].description
@@ -331,7 +331,7 @@ public class AnnotationFile
             }
             if (hasValues)
             {
-              if (row.annotations[j].value != Float.NaN)
+              if (!Float.isNaN(row.annotations[j].value))
               {
                 text.append(comma + row.annotations[j].value);
               }
index 57f6384..fbe871b 100755 (executable)
@@ -1384,7 +1384,7 @@ public class FeaturesFile extends AlignFile
             out.append(next[j].end);
             out.append("\t");
             out.append(next[j].type);
-            if (next[j].score != Float.NaN)
+            if (!Float.isNaN(next[j].score))
             {
               out.append("\t");
               out.append(next[j].score);
index 7c96d45..6d8ce5f 100644 (file)
@@ -152,7 +152,7 @@ public class SequenceAnnotationReport
               }
             }
             // check score should be shown
-            if (feature.getScore() != Float.NaN)
+            if (!Float.isNaN(feature.getScore()))
             {
               float[][] rng = (minmax == null) ? null : ((float[][]) minmax
                       .get(feature.getType()));
index 3d598d2..d1af2cf 100644 (file)
@@ -220,7 +220,7 @@ public class Sequencefeature extends Rangetype
       }
     }
     dsa.setGroup(feature.getFeatureGroup());
-    if (feature.getScore() != Float.NaN)
+    if (!Float.isNaN(feature.getScore()))
     {
       Score fscore = new Score();
       dsa.setScore(new Score[]
index 7eda2f7..0f2a49c 100644 (file)
@@ -349,7 +349,7 @@ public class FeatureRenderer extends
         else if (showFeature(sequenceFeature))
         {
           if (av_isShowSeqFeatureHeight
-                  && sequenceFeature.score != Float.NaN)
+                  && !Float.isNaN(sequenceFeature.score))
           {
             renderScoreFeature(g, seq,
                     seq.findIndex(sequenceFeature.begin) - 1,
index 4f1cb58..8a55f79 100644 (file)
@@ -145,7 +145,7 @@ public class GraduatedColor
   public boolean isColored(SequenceFeature feature)
   {
     float val = feature.getScore();
-    if (val == Float.NaN)
+    if (Float.isNaN(val))
     {
       return true;
     }
@@ -153,7 +153,7 @@ public class GraduatedColor
     {
       return true;
     }
-    if (this.thrsh == Float.NaN)
+    if (Float.isNaN(this.thrsh))
     {
       return true;
     }
@@ -211,7 +211,7 @@ public class GraduatedColor
       return getMaxColor();
     }
     float scr = feature.getScore();
-    if (scr == Float.NaN)
+    if (Float.isNaN(scr))
     {
       return getMinColor();
     }
index 674f3d1..19c6ca8 100644 (file)
@@ -369,7 +369,7 @@ public abstract class FeatureRendererModel implements
         {
           allfeatures.add(features[index].getType());
         }
-        if (features[index].score != Float.NaN)
+        if (!Float.isNaN(features[index].score))
         {
           int nonpos = features[index].getBegin() >= 1 ? 0 : 1;
           float[][] mm = (float[][]) minmax.get(features[index].getType());
index dfb13a6..91be2e6 100644 (file)
@@ -265,7 +265,7 @@ public class AADisorderClient extends JabawsCalcWorker implements
                           + rn.from, base + rn.to, methodName);
                 }
                 dseq.addSequenceFeature(sf);
-                if (last != val && last != Float.NaN)
+                if (last != val && !Float.isNaN(last))
                 {
                   fc.put(sf.getType(), sf);
                 }