private void addMatcher(Matcher m) { if (m == null) { throw new IllegalArgumentException("matcher must not be null"); } CompoundMatcher peek = matcherStack.peek(); if (peek == null) { throw new NullPointerException("Top of stack is null"); } peek.addChild(m); if (nextMatchedIsDisabled) { if (peek instanceof Filter) { ((Filter) peek).disable(m); } else { assert false; } nextMatchedIsDisabled = false; } }
@Override public void writeXML(XMLOutput xmlOutput, boolean disabled) throws IOException { if (numberChildren() == 1) { // System.out.println("One child: " + this); childIterator().next().writeXML(xmlOutput, disabled); return; } xmlOutput.startTag("And"); if (disabled) { xmlOutput.addAttribute("disabled", "true"); } xmlOutput.stopTag(false); super.writeChildrenXML(xmlOutput); xmlOutput.closeTag("And"); }
@Override public void writeXML(XMLOutput xmlOutput, boolean disabled) throws IOException { if (numberChildren() == 1) { // System.out.println("One child: " + this); childIterator().next().writeXML(xmlOutput, disabled); return; } xmlOutput.startTag("And"); if (disabled) { xmlOutput.addAttribute("disabled", "true"); } xmlOutput.stopTag(false); super.writeChildrenXML(xmlOutput); xmlOutput.closeTag("And"); }
private void addMatcher(Matcher m) { if (m == null) { throw new IllegalArgumentException("matcher must not be null"); } CompoundMatcher peek = matcherStack.peek(); if (peek == null) { throw new NullPointerException("Top of stack is null"); } peek.addChild(m); if (nextMatchedIsDisabled) { if (peek instanceof Filter) { ((Filter) peek).disable(m); } else { assert false; } nextMatchedIsDisabled = false; } }
private static Matcher makeMatcher(Collection<SortableValue> sortables, boolean andOr) { if (sortables.size() == 1) { for (SortableValue s : sortables) { return makeMatcher(s); } } edu.umd.cs.findbugs.filter.CompoundMatcher matcher; if (andOr == true) { matcher = new AndMatcher(); } else { matcher = new OrMatcher(); } for (SortableValue s : sortables) { matcher.addChild(makeMatcher(s)); } return matcher; }