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

InExpr.java

00001 package edu.ksu.cis.bandera.jext;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 1998, 1999   Shawn Laubach (laubach@acm.org)        *
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 ca.mcgill.sable.util.VectorSet;
00036 import java.util.Vector;
00037 
00038 /**
00039  * This class was made to be used as a Jimple expression but it might not
00040  * stand up under some analyses because the op2 does not return an expression
00041  * but a set instead.  If this becomes a problem, email me at laubach@acm.org
00042  * and I can update the code.
00043  */
00044 
00045 public class InExpr implements ca.mcgill.sable.soot.jimple.ConditionExpr {
00046     protected ca.mcgill.sable.soot.jimple.ValueBox op1Box;
00047     protected ca.mcgill.sable.util.Set op2;
00048 /**
00049  * InExpr constructor comment.
00050  */
00051 public InExpr(ca.mcgill.sable.soot.jimple.Value op1, ca.mcgill.sable.util.Set op2) {
00052     super();
00053     op1Box = ca.mcgill.sable.soot.jimple.Jimple.v().newVariableBox(op1);
00054     this.op2 = op2;
00055 }
00056 /**
00057  * InExpr constructor comment.
00058  */
00059 public InExpr(ca.mcgill.sable.soot.jimple.Value op1, Vector op2) {
00060     super();
00061     op1Box = ca.mcgill.sable.soot.jimple.Jimple.v().newVariableBox(op1);
00062     this.op2 = new VectorSet();
00063     for (int i = 0; i < op2.size(); i++)
00064         this.op2.add(op2.elementAt(i));
00065 }
00066 /**
00067  * apply method comment.
00068  */
00069 public void apply(ca.mcgill.sable.util.Switch sw) {
00070     ((BanderaExprSwitch)sw).caseInExpr(this);
00071 }
00072 /**
00073  * getOp1 method comment.
00074  */
00075 public ca.mcgill.sable.soot.jimple.Value getOp1() {
00076     return op1Box.getValue();
00077 }
00078 /**
00079  * getOp1Box method comment.
00080  */
00081 public ca.mcgill.sable.soot.jimple.ValueBox getOp1Box() {
00082     return op1Box;
00083 }
00084 /**
00085  * getOp2 method comment.
00086  */
00087 public ca.mcgill.sable.soot.jimple.Value getOp2() {
00088     return null;
00089 }
00090 /**
00091  * getOp2Box method comment.
00092  */
00093 public ca.mcgill.sable.soot.jimple.ValueBox getOp2Box() {
00094     return null;
00095 }
00096 /**
00097  * This method was created in VisualAge.
00098  * @return Set
00099  */
00100 public ca.mcgill.sable.util.Set getSet() {
00101     return op2;
00102 }
00103 /**
00104  * getSymbol method comment.
00105  */
00106 public String getSymbol() {
00107     return " in ";
00108 }
00109 /**
00110  * getType method comment.
00111  */
00112 public ca.mcgill.sable.soot.Type getType() {
00113     return getOp1().getType();
00114 }
00115 /**
00116  * getUseBoxes method comment.
00117  */
00118 public ca.mcgill.sable.util.List getUseBoxes() {
00119     ca.mcgill.sable.util.List list = new ca.mcgill.sable.util.ArrayList();
00120     
00121     list.addAll(op1Box.getValue().getUseBoxes());
00122     list.add(op1Box);
00123     
00124     return list;
00125 }
00126 /**
00127  * setOp1 method comment.
00128  */
00129 public void setOp1(ca.mcgill.sable.soot.jimple.Value op1) {
00130     op1Box = ca.mcgill.sable.soot.jimple.Jimple.v().newVariableBox(op1);
00131 }
00132 /**
00133  * setOp2 method comment.
00134  */
00135 public void setOp2(ca.mcgill.sable.soot.jimple.Value op2) {
00136 }
00137 /**
00138  * This method was created in VisualAge.
00139  * @param s Set
00140  */
00141 public void setOp2(ca.mcgill.sable.util.Set s) {
00142     op2 = s;
00143 }
00144 /**
00145  * toBriefString method comment.
00146  */
00147 public String toBriefString() {
00148     ca.mcgill.sable.soot.jimple.Value op1 = op1Box.getValue();
00149     String leftOp = ((ca.mcgill.sable.soot.ToBriefString) op1).toBriefString(), rightOp = op2.toString();
00150     return leftOp + getSymbol() + rightOp;
00151 }
00152 /**
00153  * Returns a String that represents the value of this object.
00154  * @return a string representation of the receiver
00155  */
00156 public String toString() {
00157     ca.mcgill.sable.soot.jimple.Value op1 = op1Box.getValue();
00158     String leftOp = op1.toString(), rightOp = op2.toString();
00159     return leftOp + getSymbol() + rightOp;
00160 }
00161 }

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