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.Vector;
10:
11: /**
12: * @author mucbj0
13: *
14: * To change the template for this generated type comment go to
15: * Window>Preferences>Java>Code Generation>Code and Comments
16: */
17: public class Trace extends Vector {
18:
19: // private static Logger logger = Logger.getLogger(Trace.class.getName());
20:
21: public Trace(Vector adjTrace, MethodMap allMethods) {
22: super ();
23:
24: //!! doublet code with TraceList
25: for (int i = 0; i < adjTrace.size(); i++) {
26:
27: String key = (String) adjTrace.elementAt(i);
28: if (key != null && !"".equals(key)) {
29: MethodWrapper m = (MethodWrapper) allMethods.get(key);
30: if (m != null) {
31: TracedMethod tm = new TracedMethod(m);
32: tm.setMethod((MethodWrapper) allMethods.get(key));
33: this .add(tm);
34: } else {
35: System.out.println("Method not resolved for key: "
36: + key);
37: }
38: } else {
39: System.out.println("Trace contains key: " + key);
40: }
41: }
42: }
43:
44: public boolean sameNameAndSizeButNotEqual(Trace searchTrace) {
45: TracedMethod this Tm = (TracedMethod) this
46: .elementAt(this .size() - 1);
47: TracedMethod searchTraceTm = (TracedMethod) searchTrace
48: .elementAt(searchTrace.size() - 1);
49: return (this .size() == searchTrace.size() && this Tm.toKey()
50: .equals(searchTraceTm.toKey()));
51: }
52:
53: public Trace() {
54: super ();
55: }
56:
57: /* (non-Javadoc)
58: * @see antlr.collections.impl.Vector#elementAt(int)
59: */
60: public TracedMethod traceElementAt(int arg0) {
61: // TODO Auto-generated method stub
62: return (TracedMethod) super.elementAt(arg0);
63: }
64:
65: }
|