JAL-2507 test if an annotation is ‘whitespace’
authorJim Procter <jprocter@issues.jalview.org>
Thu, 11 May 2017 14:29:00 +0000 (15:29 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 11 May 2017 14:29:00 +0000 (15:29 +0100)
src/jalview/datamodel/Annotation.java

index fc8688c..8de8eb2 100755 (executable)
@@ -198,4 +198,18 @@ public class Annotation
     }
     return sb.toString();
   }
+
+  /**
+   * @return true if annot is 'whitespace' annotation (zero score, whitespace or
+   *         zero length display character, label, description
+   */
+  public boolean isWhitespace()
+  {
+    return ((value == 0f)
+            && ((description == null) || (description.trim()
+                    .length() == 0))
+            && ((displayCharacter == null) || (displayCharacter
+                    .trim().length() == 0))
+            && (secondaryStructure == '\0' || (secondaryStructure == ' ')) && colour == null);
+  }
 }