Merge commit 'ab43013b7e357b84b4abade0dba949668dfb2a0e' into develop
[jalview.git] / src / jalview / analysis / Finder.java
index b253642..faf79d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
  * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
@@ -42,6 +42,8 @@ public class Finder
 
   boolean caseSensitive = false;
 
+  private boolean includeDescription = false;
+
   boolean findAll = false;
 
   com.stevesoft.pat.Regex regex = null;
@@ -150,7 +152,8 @@ public class Finder
           }
         }
 
-        if (regex.search(seq.getDescription()))
+        if (isIncludeDescription() && seq.getDescription() != null
+                && regex.search(seq.getDescription()))
         {
           idMatch.addElement(seq);
           hasResults = true;
@@ -203,7 +206,7 @@ public class Finder
           {
             continue;
           }
-
+// if invalid string used, then regex has no matched to/from
           int sres = seq
                   .findPosition(resIndex
                           + Integer.parseInt(spaces.elementAt(resIndex)
@@ -373,4 +376,14 @@ public class Finder
   {
     this.seqIndex = seqIndex;
   }
+
+  public boolean isIncludeDescription()
+  {
+    return includeDescription;
+  }
+
+  public void setIncludeDescription(boolean includeDescription)
+  {
+    this.includeDescription = includeDescription;
+  }
 }