/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
public void testNonePredicateEx5() { PredicateUtils.nonePredicate(Collections.EMPTY_LIST); }
public void testNonePredicateEx3() { try { PredicateUtils.nonePredicate(new Predicate[] {null, null}); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNonePredicateEx4() { try { PredicateUtils.nonePredicate((Collection) null); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNonePredicateEx1() { try { PredicateUtils.nonePredicate((Predicate[]) null); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNonePredicateEx2() { try { PredicateUtils.nonePredicate(new Predicate[] {null}); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNonePredicateEx6() { try { Collection coll = new ArrayList(); coll.add(null); coll.add(null); PredicateUtils.nonePredicate(coll); } catch (IllegalArgumentException ex) { return; } fail(); }
public void testNonePredicate() { assertTrue(PredicateUtils.nonePredicate( new Predicate[] {}).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.truePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.truePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(false, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.truePredicate()}).evaluate(null)); assertEquals(true, PredicateUtils.nonePredicate(new Predicate[] { PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate(), PredicateUtils.falsePredicate()}).evaluate(null)); Collection coll = new ArrayList(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.truePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.truePredicate()); assertEquals(false, PredicateUtils.nonePredicate(coll).evaluate(null)); coll.clear(); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate()); coll.add(PredicateUtils.falsePredicate());
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }
/** * Create a new Predicate that returns true if neither of the specified * predicates are true. * * @see org.apache.commons.collections.functors.NonePredicate * * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>neither</code> predicate * @throws IllegalArgumentException if either predicate is null */ public static Predicate neitherPredicate(Predicate predicate1, Predicate predicate2) { return nonePredicate(new Predicate[] { predicate1, predicate2 }); }