Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ObservableExtractor.java

00001 package edu.ksu.cis.bandera.birc;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 1998, 1999   James Corbett (corbett@hawaii.edu)     *
00006  * All rights reserved.                                              *
00007  *                                                                   *
00008  * This work was done as a project in the SAnToS Laboratory,         *
00009  * Department of Computing and Information Sciences, Kansas State    *
00010  * University, USA (http://www.cis.ksu.edu/santos).                  *
00011  * It is understood that any modification not identified as such is  *
00012  * not covered by the preceding statement.                           *
00013  *                                                                   *
00014  * This work is free software; you can redistribute it and/or        *
00015  * modify it under the terms of the GNU Library General Public       *
00016  * License as published by the Free Software Foundation; either      *
00017  * version 2 of the License, or (at your option) any later version.  *
00018  *                                                                   *
00019  * This work is distributed in the hope that it will be useful,      *
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00022  * Library General Public License for more details.                  *
00023  *                                                                   *
00024  * You should have received a copy of the GNU Library General Public *
00025  * License along with this toolkit; if not, write to the             *
00026  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00027  * Boston, MA  02111-1307, USA.                                      *
00028  *                                                                   *
00029  * Java is a trademark of Sun Microsystems, Inc.                     *
00030  *                                                                   *
00031  * To submit a bug report, send a comment, or get the latest news on *
00032  * this project and other SAnToS projects, please visit the web-site *
00033  *                http://www.cis.ksu.edu/santos                      *
00034  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00035 import java.io.*;
00036 import java.util.*;
00037 
00038 import edu.ksu.cis.bandera.jext.*;
00039 
00040 import ca.mcgill.sable.util.*;
00041 import ca.mcgill.sable.soot.*;
00042 import ca.mcgill.sable.soot.jimple.*;
00043 
00044 public class ObservableExtractor extends AbstractBanderaValueSwitch 
00045 {
00046     Hashtable observableSet;
00047 
00048     public ObservableExtractor(Hashtable observableSet) {
00049     this.observableSet = observableSet;
00050     }
00051     public void caseAddExpr(AddExpr expr) {
00052     expr.getOp1().apply(this);
00053     expr.getOp2().apply(this);
00054     }
00055     public void caseArrayRef(ArrayRef expr) {
00056     expr.getBase().apply(this);
00057     expr.getIndex().apply(this);
00058     }
00059     public void caseCastExpr(CastExpr expr) {
00060     expr.getOp().apply(this);
00061     }
00062     public void caseChooseExpr(ChooseExpr expr) {
00063     }
00064     public void caseComplementExpr(ComplementExpr expr) {
00065     expr.getOp().apply(this);
00066     }
00067     public void caseDivExpr(DivExpr expr) {
00068     expr.getOp1().apply(this);
00069     expr.getOp2().apply(this);
00070     }
00071     public void caseEqExpr(EqExpr expr)
00072     {
00073     expr.getOp1().apply(this);
00074     expr.getOp2().apply(this);
00075     }
00076     public void caseGeExpr(GeExpr expr) {
00077     expr.getOp1().apply(this);
00078     expr.getOp2().apply(this);
00079     }
00080     public void caseGtExpr(GtExpr expr) {
00081     expr.getOp1().apply(this);
00082     expr.getOp2().apply(this);
00083     }
00084     public void caseInExpr(InExpr expr) {
00085     expr.getOp1().apply(this);
00086     }
00087     public void caseInstanceFieldRef(InstanceFieldRef expr) {
00088     expr.getBase().apply(this);
00089     SootField field = expr.getField();
00090     observableSet.put(field,field);
00091     }
00092     public void caseInstanceOfExpr(InstanceOfExpr expr) {
00093     expr.getOp().apply(this);
00094     }
00095     public void caseIntConstant(IntConstant expr) {
00096     }
00097     public void caseLeExpr(LeExpr expr) {
00098     expr.getOp1().apply(this);
00099     expr.getOp2().apply(this);
00100     }
00101     public void caseLengthExpr(LengthExpr expr) {
00102     expr.getOp().apply(this);
00103     }
00104     public void caseLocalExpr(LocalExpr expr) { 
00105     SootMethod method = expr.getMethod();
00106     Local local = expr.getLocal();
00107     String key = ExprExtractor.localKey(method,local);
00108     observableSet.put(key,key);
00109     }
00110     public void caseLocationTestExpr(LocationTestExpr expr) {
00111     Vector stmts = expr.getStmts();
00112     for (int i = 0; i < stmts.size(); i++) 
00113         observableSet.put(stmts.elementAt(i),stmts);
00114     }
00115     public void caseLogicalAndExpr(LogicalAndExpr expr) {
00116     expr.getOp1().apply(this);
00117     expr.getOp2().apply(this);
00118     }
00119     public void caseLogicalOrExpr(LogicalOrExpr expr) {
00120     expr.getOp1().apply(this);
00121     expr.getOp2().apply(this);
00122     }
00123     public void caseLtExpr(LtExpr expr) {
00124     expr.getOp1().apply(this);
00125     expr.getOp2().apply(this);
00126     }
00127     public void caseMulExpr(MulExpr expr) {
00128     expr.getOp1().apply(this);
00129     expr.getOp2().apply(this);
00130     }
00131     public void caseNeExpr(NeExpr expr)
00132     {
00133     expr.getOp1().apply(this);
00134     expr.getOp2().apply(this);
00135     }
00136     public void caseNegExpr(NegExpr expr) {
00137     expr.getOp().apply(this);
00138     }
00139     public void caseNewArrayExpr(NewArrayExpr expr) {
00140     }
00141     public void caseNewExpr(NewExpr expr) {
00142     }
00143     public void caseNullConstant(NullConstant expr) {
00144     }
00145     public void caseRemExpr(RemExpr expr) {
00146     expr.getOp1().apply(this);
00147     expr.getOp2().apply(this);
00148     }
00149     public void caseStaticFieldRef(StaticFieldRef expr) {
00150     SootField field = expr.getField();
00151     observableSet.put(field,field);
00152     }
00153     public void caseStaticInvokeExpr(StaticInvokeExpr expr) {
00154     throw new RuntimeException("Unhandled static method call: " + expr);
00155     }
00156     public void caseStringConstant(StringConstant expr) {
00157     }
00158     public void caseSubExpr(SubExpr expr) {
00159     expr.getOp1().apply(this);
00160     expr.getOp2().apply(this);
00161     }
00162     public void defaultCase(Object o) {
00163     throw new RuntimeException("Unhandled expression type: " + o);
00164     }
00165 }

Generated at Thu Feb 7 06:50:57 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001