1 package net.jaekl.cfb.xml;
3 import java.io.PrintWriter;
4 import java.util.ArrayList;
5 import java.util.Collections;
8 import net.jaekl.cfb.util.Util;
9 import net.jaekl.qd.xml.ParseResult;
10 import net.jaekl.qd.xml.XmlParseException;
12 public class BugCollection extends ParseResult {
14 static final String TAG = "BugCollection";
15 static final String[] INTERNAL = { };
16 static final Object[][] EXTERNAL = { { BugInstance.TAG, BugInstance.class} };
18 ArrayList<BugInstance> m_bugs;
20 public BugCollection() {
21 super(TAG, INTERNAL, EXTERNAL);
22 m_bugs = new ArrayList<BugInstance>();
25 public List<BugInstance> getBugs() { return Collections.unmodifiableList(m_bugs); }
26 public void add(BugInstance bug) { m_bugs.add(bug); }
29 public void endContents(String uri, String localName, String qName, String chars)
30 throws XmlParseException
36 public void endExternal(String uri, String localName, String qName)
37 throws XmlParseException
39 if (BugInstance.TAG.equals(localName)) {
40 ParseResult[] collected = collectParsedChildren(BugInstance.class);
41 for (ParseResult pr : collected) {
42 assert(pr instanceof BugInstance);
43 m_bugs.add((BugInstance) pr);
49 public void dump(PrintWriter pw, int indent) {
50 super.dump(pw, indent);
51 for (BugInstance bug : m_bugs) {
52 bug.dump(pw, indent + 2);
57 public boolean equals(Object obj) {
61 if (! (obj instanceof BugCollection)) {
64 BugCollection other = (BugCollection)obj;
66 return Util.listsAreEqual(this.m_bugs, other.m_bugs);
70 public int hashCode() {
71 return Util.objHashCode(m_bugs);