JAL-2808 update spike to latest (filter range, Present option)
[jalview.git] / src / jalview / util / matcher / Matcher.java
index 715694c..14a8585 100644 (file)
@@ -53,7 +53,7 @@ public class Matcher implements MatcherI
     else
     {
       // pattern matches will be non-case-sensitive
-      pattern = compareTo.toUpperCase();
+      pattern = compareTo == null ? null : compareTo.toUpperCase();
     }
 
     // if we add regex conditions (e.g. matchesPattern), then
@@ -105,7 +105,8 @@ public class Matcher implements MatcherI
     if (val == null)
     {
       return condition == Condition.NotContains
-              || condition == Condition.NotMatches;
+              || condition == Condition.NotMatches 
+              || condition == Condition.NotPresent;
     }
     
     String upper = val.toUpperCase().trim();
@@ -123,6 +124,11 @@ public class Matcher implements MatcherI
     case NotContains:
       matched = upper.indexOf(pattern) == -1;
       break;
+    case Present:
+      matched = true;
+      break;
+    default:
+      break;
     }
     return matched;
   }
@@ -161,6 +167,8 @@ public class Matcher implements MatcherI
     case GE:
       matched = f >= value;
       break;
+    default:
+      break;
     }
 
     return matched;