diff options
author | Brian Vosburgh | 2015-10-20 18:15:16 +0000 |
---|---|---|
committer | Brian Vosburgh | 2015-10-20 18:15:16 +0000 |
commit | c484b3b8ffe866f4b158ce7e9d5a565fae76fec3 (patch) | |
tree | 14e7a5cf7dbdafef86439b3f1155843365f7e246 | |
parent | 9cad45998a8b4e5da0014376f61238c40df834db (diff) | |
download | webtools.dali-c484b3b8ffe866f4b158ce7e9d5a565fae76fec3.tar.gz webtools.dali-c484b3b8ffe866f4b158ce7e9d5a565fae76fec3.tar.xz webtools.dali-c484b3b8ffe866f4b158ce7e9d5a565fae76fec3.zip |
add PredicateTools.isNotEqual(...) and .isNotIdentical(...)
-rw-r--r-- | common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/predicate/PredicateTools.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/predicate/PredicateTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/predicate/PredicateTools.java index 9f66583d32..03c41b05b2 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/predicate/PredicateTools.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/predicate/PredicateTools.java @@ -76,7 +76,7 @@ public final class PredicateTools { /** * Return a predicate that will evaluate to <code>true</code> - * for any object {@link Object#equals(Object) equal to} the specified + * for any object {@link Object#equals(Object) equal} to the specified * criterion. If the criterion is <code>null</code>, the predicate * will evaluate to <code>true</code> if the variable is also * <code>null</code>. @@ -88,6 +88,18 @@ public final class PredicateTools { /** * Return a predicate that will evaluate to <code>true</code> + * for any object <em>not</em> {@link Object#equals(Object) equal} to the specified + * criterion. If the criterion is <code>null</code>, the predicate + * will evaluate to <code>true</code> if the variable is not + * <code>null</code>. + * @param <V> the type of objects to be evaluated by the predicate + */ + public static <V> Predicate<V> isNotEqual(V criterion) { + return new NOT<V>(isEqual(criterion)); + } + + /** + * Return a predicate that will evaluate to <code>true</code> * for any object identical to (<code>==</code>) the specified * criterion. If the criterion is <code>null</code>, the predicate * will evaluate to <code>true</code> if the variable is also @@ -98,6 +110,18 @@ public final class PredicateTools { return new IsIdentical<V>(criterion); } + /** + * Return a predicate that will evaluate to <code>true</code> + * for any object that is <em>not</em> identical (<code>==</code>) the specified + * criterion. If the criterion is <code>null</code>, the predicate + * will evaluate to <code>true</code> if the variable is not + * <code>null</code>. + * @param <V> the type of objects to be evaluated by the predicate + */ + public static <V> Predicate<V> isNotIdentical(V criterion) { + return new NOT<V>(isIdentical(criterion)); + } + // ********** AND ********** |