KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > inspectors > metrics > callertrace > Trace


1 /*
2  * Created on Nov 4, 2003
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */

7 package org.hammurapi.inspectors.metrics.callertrace;
8
9
10 import java.util.Vector JavaDoc;
11
12
13 /**
14  * @author mucbj0
15  *
16  * To change the template for this generated type comment go to
17  * Window>Preferences>Java>Code Generation>Code and Comments
18  */

19 public class Trace extends Vector JavaDoc {
20
21     // private static Logger logger = Logger.getLogger(Trace.class.getName());
22

23     public Trace(Vector JavaDoc adjTrace, MethodMap allMethods){
24         super();
25
26         //!! doublet code with TraceList
27
for (int i= 0; i<adjTrace.size(); i++){
28
29             String JavaDoc key = (String JavaDoc)adjTrace.elementAt(i);
30         if( key != null && !"".equals( key ) ){
31             MethodWrapper m = (MethodWrapper)allMethods.get(key);
32             if (m != null ){
33         TracedMethod tm = new TracedMethod(m);
34         tm.setMethod((MethodWrapper)allMethods.get(key));
35         this.add(tm);
36             }else {
37                 System.out.println( "Method not resolved for key: " + key);
38             }
39         }else{
40             System.out.println( "Trace contains key: " + key);
41             }
42         }
43     }
44     
45     public boolean sameNameAndSizeButNotEqual(Trace searchTrace ){
46         TracedMethod thisTm = (TracedMethod) this.elementAt(this.size() - 1);
47         TracedMethod searchTraceTm = (TracedMethod) searchTrace.elementAt(searchTrace.size() - 1);
48         return ( this.size() == searchTrace.size() &&
49                 thisTm.toKey().equals( searchTraceTm.toKey() ) );
50     }
51
52     public Trace(){
53         super();
54     }
55     /* (non-Javadoc)
56      * @see antlr.collections.impl.Vector#elementAt(int)
57      */

58     public TracedMethod traceElementAt(int arg0) {
59         // TODO Auto-generated method stub
60
return (TracedMethod)super.elementAt(arg0);
61     }
62
63 }
64
65
Popular Tags