01: /*
02: * Created on Nov 4, 2003
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.hammurapi.inspectors.metrics.callertrace;
08:
09: import java.util.Enumeration;
10: import java.util.Hashtable;
11:
12: import org.w3c.dom.Document;
13: import org.w3c.dom.Element;
14:
15: /**
16: * @author mucbj0
17: *
18: * To change the template for this generated type comment go to
19: * Window>Preferences>Java>Code Generation>Code and Comments
20: */
21: public class TraceTable extends Hashtable {
22:
23: /* (non-Javadoc)
24: * @see java.util.Dictionary#get(java.lang.Object)
25: */
26: public synchronized TraceList get(String key) {
27: // TODO Auto-generated method stub
28: return (TraceList) super .get(key);
29: }
30:
31: public Element toDom(Document document){
32: Element ret=document.createElement("TraceTable");
33: ret.setAttribute("size", String.valueOf( this .size() ));
34:
35: Enumeration enum = this .elements();
36: Enumeration enumKey = this .keys();
37: while(enum.hasMoreElements()){
38: String key = (String)enumKey.nextElement();
39: TraceList tList = (TraceList)enum.nextElement();
40:
41: ret.appendChild(tList.toDom( document ));
42: }
43: return ret;
44: }
45:
46: public String toXml() {
47: StringBuffer sb = new StringBuffer();
48: sb.append("<TraceTable size=\"" + this.size() + "\">\n");
49: Enumeration enum = this.elements();
50: Enumeration enumKey = this.keys();
51: while(enum.hasMoreElements()){
52: String key = (String)enumKey.nextElement();
53: TraceList tList = (TraceList)enum.nextElement();
54: sb.append(tList.toXml() );
55: }
56: sb.append("</TraceTable>\n");
57: return sb.toString();
58: }
59:
60: }
|