/** * Add if not present, but do not enable if already present and disabled * * @param child */ public void softAdd(Matcher child) { super.addChild(child); }
@Override public void writeXML(XMLOutput xmlOutput, boolean disabled) throws IOException { if (numberChildren() == 1) { childIterator().next().writeXML(xmlOutput, false); return; } xmlOutput.startTag("Or"); if (disabled) { xmlOutput.addAttribute("disabled", "true"); } xmlOutput.stopTag(false); writeChildrenXML(xmlOutput); xmlOutput.closeTag("Or"); }
@Override public void clear() { disabled.clear(); super.clear(); }
public boolean isEmpty() { return super.numberChildren() == 0; }
addMatcher(new FieldMatcher(name, type, role)); } else if ("Or".equals(qName)) { CompoundMatcher matcher = new OrMatcher(); pushCompoundMatcherAsChild(matcher); } else if ("And".equals(qName) || "Match".equals(qName)) {
@Override public void removeChild(Matcher child) { enable(child);// Remove from disabled before removing it super.removeChild(child); }
@Override public int hashCode() { int result = super.hashCode(); result = PRIME * result + ((disabled == null) ? 0 : disabled.hashCode()); return result; }
@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 equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof Filter)) { return false; } final Filter other = (Filter) obj; if (disabled == null) { if (other.disabled != null) { return false; } } else if (!disabled.equals(other.disabled)) { return false; } return true; }
@Override public String toString() { if (numberChildren() == 1) { return super.toString(); } return "Or(" + super.toString() + ")"; }
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; }
@Override public void removeChild(Matcher child) { enable(child);// Remove from disabled before removing it super.removeChild(child); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((disabled == null) ? 0 : disabled.hashCode()); return result; }
@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 equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof Filter)) { return false; } final Filter other = (Filter) obj; if (disabled == null) { if (other.disabled != null) { return false; } } else if (!disabled.equals(other.disabled)) { return false; } return true; }
@Override public void writeXML(XMLOutput xmlOutput, boolean disabled) throws IOException { if (numberChildren() == 1) { childIterator().next().writeXML(xmlOutput, false); return; } xmlOutput.startTag("Or"); if (disabled) { xmlOutput.addAttribute("disabled", "true"); } xmlOutput.stopTag(false); writeChildrenXML(xmlOutput); xmlOutput.closeTag("Or"); }
@Override public void addChild(Matcher child) { super.addChild(child); enable(child); }
public boolean isEmpty() { return super.numberChildren() == 0; }
addMatcher(new FieldMatcher(name, type, role)); } else if ("Or".equals(qName)) { CompoundMatcher matcher = new OrMatcher(); pushCompoundMatcherAsChild(matcher); } else if ("And".equals(qName) || "Match".equals(qName)) {
@Override public void clear() { disabled.clear(); super.clear(); }