KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > rta > RapidTypeAnalysis


1 /*
2  * Bytecode Analysis Framework
3  * Copyright (C) 2003-2006 University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.ba.rta;
21
22 import java.util.HashSet JavaDoc;
23
24 import org.apache.bcel.classfile.JavaClass;
25
26 import edu.umd.cs.findbugs.ba.AnalysisContext;
27 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
28 import edu.umd.cs.findbugs.classfile.IClassObserver;
29
30 /**
31  * Driver for performing Rapid Type Analysis (RTA) on a collection of
32  * classes. RTA is an algorithm devised by David Bacon to compute
33  * an accurate call graph for an object-oriented program.
34  */

35 public class RapidTypeAnalysis implements IClassObserver {
36     // Set of classes observed.
37
private HashSet JavaDoc<JavaClass> observedClassSet;
38
39     /**
40      * Constructor.
41      */

42     public RapidTypeAnalysis() {
43         this.observedClassSet = new HashSet JavaDoc<JavaClass>();
44     }
45
46     public void execute() {
47         // TODO: implement
48
}
49
50     public void observeClass(ClassDescriptor classDescriptor) {
51         try {
52             JavaClass javaClass = AnalysisContext.currentAnalysisContext().lookupClass(classDescriptor);
53             observedClassSet.add(javaClass);
54         } catch (ClassNotFoundException JavaDoc e) {
55             // Shouldn't happen
56
}
57     }
58
59 }
60
61 // vim:ts=4
62
Popular Tags