8fb78e411ab973b770e30a618d26e82f52ad97ad
[cfb.git] / prod / net / jaekl / cfb / xml / BugCollection.java
1 package net.jaekl.cfb.xml;
2
3 import java.io.PrintWriter;
4 import java.util.ArrayList;
5
6 import net.jaekl.qd.xml.ParseResult;
7 import net.jaekl.qd.xml.XmlParseException;
8
9 public class BugCollection extends ParseResult {
10
11         static final String TAG = "BugCollection";
12         static final String[] INTERNAL = { };
13         static final Object[][] EXTERNAL = { { BugInstance.TAG, BugInstance.class} };
14
15         ArrayList<BugInstance> m_bugs;
16         
17         public BugCollection() {
18                 super(TAG, INTERNAL, EXTERNAL);
19                 m_bugs = new ArrayList<BugInstance>();
20         }
21         
22         @Override
23         public void endContents(String uri, String localName, String qName,     String chars) 
24                 throws XmlParseException 
25         {
26                 // no-op
27         }
28
29         @Override
30         public void endExternal(String uri, String localName, String qName)
31                 throws XmlParseException 
32         {
33                 if (BugInstance.TAG.equals(localName)) {
34                         ParseResult[] collected = collectParsedChildren(BugInstance.class);
35                         for (ParseResult pr : collected) {
36                                 assert(pr instanceof BugInstance);
37                                 m_bugs.add((BugInstance) pr);
38                         }
39                 }
40         }
41         
42         @Override
43         public void dump(PrintWriter pw, int indent) {
44                 super.dump(pw, indent);
45                 for (BugInstance bug : m_bugs) {
46                         bug.dump(pw, indent + 2);
47                 }
48         }
49
50 }