X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=prod%2Fnet%2Fjaekl%2Fcfb%2Fxml%2FBugInstance.java;h=f1f8537177befd7c51ad867a89a03ee993e938b4;hp=81ebcfcd671f4abdf8afa16fe62bec1175116abd;hb=a938b67bf3d3bd86f8dd7b1f958e81007bf6f2fe;hpb=08a530ef53cc4756f5e632b69c78830872ebd9f4 diff --git a/prod/net/jaekl/cfb/xml/BugInstance.java b/prod/net/jaekl/cfb/xml/BugInstance.java index 81ebcfc..f1f8537 100644 --- a/prod/net/jaekl/cfb/xml/BugInstance.java +++ b/prod/net/jaekl/cfb/xml/BugInstance.java @@ -1,5 +1,7 @@ package net.jaekl.cfb.xml; +import java.util.ArrayList; + import org.xml.sax.Attributes; import net.jaekl.qd.xml.ParseResult; @@ -7,28 +9,65 @@ import net.jaekl.qd.xml.XmlParseException; public class BugInstance extends ParseResult { - static final String ROOT_TAG = "BugInstance"; + static final String TAG = "BugInstance"; static final String[] INTERNAL = { }; - static final Object[][] EXTERNAL = { { BugClass.ROOT_TAG, BugClass.class}, - { BugMethod.ROOT_TAG, BugMethod.class}, - { SourceLine.ROOT_TAG, SourceLine.class} }; + static final Object[][] EXTERNAL = { { BugClass.TAG, BugClass.class}, + { BugMethod.TAG, BugMethod.class}, + { LocalVariable.TAG, LocalVariable.class}, + { SourceLine.TAG, SourceLine.class} }; + ArrayList m_classes; + ArrayList m_methods; + ArrayList m_locals; + ArrayList m_lines; + public BugInstance() { - super(ROOT_TAG, INTERNAL, EXTERNAL); + super(TAG, INTERNAL, EXTERNAL); + + m_classes = new ArrayList(); + m_methods = new ArrayList(); + m_locals = new ArrayList(); + m_lines = new ArrayList(); } @Override - public void endContents(String uri, String localName, String qName, - String chars, Attributes attr) throws XmlParseException { - // TODO Auto-generated method stub - + public void endContents(String uri, String localName, String qName, String chars, Attributes attr) + throws XmlParseException + { } @Override public void endExternal(String uri, String localName, String qName) - throws XmlParseException { - // TODO Auto-generated method stub - + throws XmlParseException + { + if (BugClass.TAG.equals(localName)) { + ParseResult[] collected = collectParsedChildren(BugClass.class); + for (ParseResult pr : collected) { + assert(pr instanceof BugClass); + m_classes.add((BugClass) pr); + } + } + else if (BugMethod.TAG.equals(localName)) { + ParseResult[] collected = collectParsedChildren(BugMethod.class); + for (ParseResult pr : collected) { + assert(pr instanceof BugMethod); + m_methods.add((BugMethod)pr); + } + } + else if (LocalVariable.TAG.equals(localName)) { + ParseResult[] collected = collectParsedChildren(LocalVariable.class); + for (ParseResult pr : collected) { + assert(pr instanceof LocalVariable); + m_locals.add((LocalVariable)pr); + } + } + else if (SourceLine.TAG.equals(localName)) { + ParseResult[] collected = collectParsedChildren(SourceLine.class); + for (ParseResult pr : collected) { + assert(pr instanceof SourceLine); + m_lines.add((SourceLine)pr); + } + } } }