gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [2/4] gora git commit: GORA-454 Implement FilterList tests
Date Mon, 11 Jan 2016 15:20:37 GMT
GORA-454 Implement FilterList tests


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/83fb8d43
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/83fb8d43
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/83fb8d43

Branch: refs/heads/master
Commit: 83fb8d435963f35fd5de9675842958e8ced175d7
Parents: 18bd38a
Author: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Authored: Mon Jan 11 06:19:25 2016 -0800
Committer: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Committed: Mon Jan 11 06:19:25 2016 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/gora/filter/FilterList.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/83fb8d43/gora-core/src/main/java/org/apache/gora/filter/FilterList.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/filter/FilterList.java b/gora-core/src/main/java/org/apache/gora/filter/FilterList.java
index e9d5a18..d327920 100644
--- a/gora-core/src/main/java/org/apache/gora/filter/FilterList.java
+++ b/gora-core/src/main/java/org/apache/gora/filter/FilterList.java
@@ -110,21 +110,22 @@ public class FilterList<K, T extends PersistentBase> implements
Filter<K, T> {
   @Override
   public boolean filter(K key, T persistent) {
     boolean filtered = false;
-    //OR
-    if (operator.equals(Operator.MUST_PASS_ONE)) {
+    switch (operator.toString()) {
+    case "MUST_PASS_ALL":
       for (Filter<K, T> filter: filters) {
         if (!filter.filter(key, persistent)) {
           return !filtered;
         }
       }
-      //AND
-    } else if (operator.equals(Operator.MUST_PASS_ALL)) {
+      break;
+    case "MUST_PASS_ONE":
       for (Filter<K, T> filter: filters) {
         if (filter.filter(key, persistent)) {
           return !filtered;
         }
       }
-    } else {
+      break;
+    default:
       throw new IllegalStateException(operator + " not yet implemented!");
     }
     return filtered;


Mime
View raw message