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

VisibleExtractor.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 edu.ksu.cis.bandera.bir.*;
00036 
00037 import ca.mcgill.sable.soot.*;
00038 
00039 /**
00040  * Jimple statement switch to determine if statement is visible.
00041  * <p>
00042  * Currently, any statement that touches a heap variable, a lock,
00043  * or a thread is visible.
00044  */
00045 
00046 public class VisibleExtractor extends AbstractExprSwitch
00047 {
00048     boolean visible = false;   // Stmt is visible?
00049 
00050     public void caseAddExpr(AddExpr expr)
00051     {
00052     expr.getOp1().apply(this);
00053     expr.getOp2().apply(this);
00054     }
00055     public void caseAndExpr(AndExpr expr)
00056     {
00057     expr.getOp1().apply(this);
00058     expr.getOp2().apply(this);
00059     }
00060     public void caseArrayExpr(ArrayExpr expr)
00061     {
00062     expr.getArray().apply(this);
00063     expr.getIndex().apply(this);
00064     }
00065     public void caseAssignAction(AssignAction assign) 
00066     {
00067     assign.getLhs().apply(this);
00068     assign.getRhs().apply(this);
00069     }
00070     public void caseDerefExpr(DerefExpr expr)
00071     {
00072     visible = true;
00073     expr.getTarget().apply(this);
00074     }
00075     public void caseDivExpr(DivExpr expr)
00076     {
00077     expr.getOp1().apply(this);
00078     expr.getOp2().apply(this);
00079     }
00080     public void caseEqExpr(EqExpr expr)
00081     {
00082     expr.getOp1().apply(this);
00083     expr.getOp2().apply(this);
00084     }
00085     public void caseLeExpr(LeExpr expr)
00086     {
00087     expr.getOp1().apply(this);
00088     expr.getOp2().apply(this);
00089     }
00090     public void caseLengthExpr(LengthExpr expr)
00091     {
00092     expr.getArray().apply(this);
00093     }
00094     public void caseLockAction(LockAction lockAction) 
00095     {
00096         visible = true;
00097     }
00098     public void caseLockTest(LockTest lockTest) 
00099     {
00100     visible = true;
00101     }
00102     public void caseLtExpr(LtExpr expr)
00103     {
00104     expr.getOp1().apply(this);
00105     expr.getOp2().apply(this);
00106     }
00107     public void caseMulExpr(MulExpr expr)
00108     {
00109     expr.getOp1().apply(this);
00110     expr.getOp2().apply(this);
00111     }
00112     public void caseNeExpr(NeExpr expr)
00113     {
00114     expr.getOp1().apply(this);
00115     expr.getOp2().apply(this);
00116     }
00117     public void caseNewExpr(NewExpr expr)
00118     {
00119     }
00120     public void caseNotExpr(NotExpr expr)
00121     {
00122     expr.getOp().apply(this);
00123     }
00124     public void caseNullExpr(NullExpr expr)
00125     {
00126     }
00127     public void caseOrExpr(OrExpr expr)
00128     {
00129     expr.getOp1().apply(this);
00130     expr.getOp2().apply(this);
00131     }
00132     public void casePrintAction(PrintAction printAction) 
00133     {
00134     }
00135     public void caseRecordExpr(RecordExpr expr)
00136     {
00137     expr.getRecord().apply(this);
00138     }
00139     public void caseRefExpr(RefExpr expr)
00140     {
00141     }
00142     public void caseRemExpr(RemExpr expr)
00143     {
00144     expr.getOp1().apply(this);
00145     expr.getOp2().apply(this);
00146     }
00147     public void caseStateVar(StateVar expr)
00148     {
00149         if (! expr.isLocal() && ! expr.isConstant())
00150         visible = true;
00151     }
00152     public void caseSubExpr(SubExpr expr)
00153     {
00154     expr.getOp1().apply(this);
00155     expr.getOp2().apply(this);
00156     }
00157     public void caseThreadAction(ThreadAction threadAction) 
00158     {
00159         visible = true;
00160     }
00161     public void caseThreadTest(ThreadTest threadTest) 
00162     {
00163         visible = true;
00164     }
00165     public boolean isVisible() {
00166     return visible;
00167     }
00168     public void reset() {
00169     visible = false;
00170     }
00171 }

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