@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (!child.match(bugInstance)) { return false; } } anyMatches = true; return true; }
@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (child.match(bugInstance)) { return true; } } return false; }
@Override public boolean match(BugInstance bugInstance) { if(!childIterator().hasNext() ) { return false; } Matcher invertedMatcher = childIterator().next(); return ! invertedMatcher.match(bugInstance); }
@Override public void reportBug(@Nonnull BugInstance bugInstance) { if (DEBUG) { System.out.print("Match ==> "); } boolean match = filter.match(bugInstance); if (DEBUG) { System.out.println(match ? "YES" : "NO"); } if (include == match) { getDelegate().reportBug(bugInstance); } } }
@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (isEnabled(child) && child.match(bugInstance)) { return true; } } return false; }
@Test public void invertMatcherShouldNegateTheOriginalMatchingResult() { BugInstance bug = new BugInstance("UUF_UNUSED_FIELD", 0); Matcher originalMatcher = FilterFactory.makeMatcher(asList(Sortables.BUGCODE), bug); assertTrue("Original matcher should match bug.", originalMatcher.match(bug)); Matcher notMatcher = FilterFactory.invertMatcher(originalMatcher); assertTrue("Should return an instance of NotMatcher.", notMatcher instanceof NotMatcher); assertFalse("Inverted matcher should now not match.", notMatcher.match(bug)); }
@Test public void shouldReturnTheOriginalMatcherWhenAskedToInvertANotMatcher() { BugInstance bug = new BugInstance("UUF_UNUSED_FIELD", 0); Matcher originalMatcher = FilterFactory.makeMatcher(asList(Sortables.BUGCODE), bug); Matcher notMatcher = FilterFactory.invertMatcher(originalMatcher); Matcher notNotMatcher = FilterFactory.invertMatcher(notMatcher); assertSame("Should return the originally wrapped matcher.", originalMatcher, notNotMatcher); assertTrue("Original matcher should now not match.", notNotMatcher.match(bug)); } }
@Override public boolean match(BugInstance bugInstance) { for (Matcher i : this) { if (!i.match(bugInstance)) { return false; } } return true; }
@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (!child.match(bugInstance)) { return false; } } anyMatches = true; return true; }
@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (child.match(bugInstance)) { return true; } } return false; }
public BugSet getBugsMatchingFilter(Matcher m) { ArrayList<BugLeafNode> people = new ArrayList<BugLeafNode>(); for (BugLeafNode p : mainList) { if (!(m.match(p.getBug()))) { people.add(p); } } return new BugSet(people, false); }
@Override public void reportBug(@Nonnull BugInstance bugInstance) { if (DEBUG) { System.out.print("Match ==> "); } boolean match = filter.match(bugInstance); if (DEBUG) { System.out.println(match ? "YES" : "NO"); } if (include == match) { getDelegate().reportBug(bugInstance); } } }
@Override public boolean match(BugInstance bugInstance) { if(!childIterator().hasNext() ) { return false; } Matcher invertedMatcher = childIterator().next(); return ! invertedMatcher.match(bugInstance); }
@Override public boolean match(BugInstance bugInstance) { Iterator<Matcher> i = childIterator(); while (i.hasNext()) { Matcher child = i.next(); if (isEnabled(child) && child.match(bugInstance)) { return true; } } return false; }