[utilities COMMIT] in /java-support/trunk/src: main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicat...

noreply at shibboleth.net noreply at shibboleth.net
Tue Mar 6 14:27:24 GMT 2012


Author: lajoie
Date: Tue Mar  6 14:27:23 2012
New Revision: 238

URL: http://svn.shibboleth.net/view/utilities?rev=238&view=rev
Log:
Logic package unit tests - JSPT-8
Remove unused predicate

Added:
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicateTest.java   (with props)
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicateTest.java   (with props)
    java-support/trunk/src/test/java/net/shibboleth/utilities/java/support/logic/CaseInsensitiveStringMatchPredicateTest.java   (with props)
Removed:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/TypeCheckAndApplyPredicate.java
Modified:
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java
    java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java?rev=238&r1=237&r2=238&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AllMatchPredicate.java Tue Mar  6 14:27:23 2012
@@ -24,9 +24,10 @@
 
 /**
  * A {@link Predicate} that checks that all items in an {@link Iterable} match a given target predicate. If the given
- * {@link Iterable} is null this method will return <code>false</code>, otherwise it passes each {@link Iterable} value
- * to the target predicate, even if those values are <code>null</code>. The first <code>false</code> returned by the
- * target predicate stops evaluation and causes this predicate to return (i.e., it short-circuits the evaluation).
+ * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
+ * {@link Iterable} value to the target predicate, even if those values are <code>null</code>. The first
+ * <code>false</code> returned by the target predicate stops evaluation and causes this predicate to return (i.e., it
+ * short-circuits the evaluation).
  * 
  * @param <T> type of object upon which this predicate operates
  */
@@ -50,12 +51,15 @@
             return false;
         }
 
+        boolean matchedAll = false;
         for (T input : inputs) {
             if (!predicate.apply(input)) {
                 return false;
+            } else {
+                matchedAll = true;
             }
         }
 
-        return true;
+        return matchedAll;
     }
 }

Modified: java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java
URL: http://svn.shibboleth.net/view/utilities/java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java?rev=238&r1=237&r2=238&view=diff
==============================================================================
--- java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java (original)
+++ java-support/trunk/src/main/java/net/shibboleth/utilities/java/support/logic/AnyMatchPredicate.java Tue Mar  6 14:27:23 2012
@@ -24,9 +24,10 @@
 
 /**
  * A {@link Predicate} that checks that any item in an {@link Iterable} matches a given target predicate. If the given
- * {@link Iterable} is null this method will return <code>false</code>, otherwise it passes each {@link Iterable} value
- * to the target predicate, even if those values are <code>null</code>. The first <code>true</code> returned by the
- * target predicate stops evaluation and causes this predicate to return (i.e., it short-circuits the evaluation).
+ * {@link Iterable} is null or contains no items this method will return <code>false</code>, otherwise it passes each
+ * {@link Iterable} value to the target predicate, even if those values are <code>null</code>. The first
+ * <code>true</code> returned by the target predicate stops evaluation and causes this predicate to return (i.e., it
+ * short-circuits the evaluation).
  * 
  * @param <T> type of object upon which this predicate operates
  */



More information about the commits mailing list