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

Predicate.java

00001 package edu.ksu.cis.bandera.specification.predicate.datastructure;
00002 
00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00004  * Bandera, a Java(TM) analysis and transformation toolkit           *
00005  * Copyright (C) 2000   Robby (robby@cis.ksu.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.util.*;
00036 import edu.ksu.cis.bandera.annotation.*;
00037 import edu.ksu.cis.bandera.jjjc.symboltable.*;
00038 import edu.ksu.cis.bandera.specification.predicate.node.*;
00039 import edu.ksu.cis.bandera.specification.predicate.exception.*;
00040 import ca.mcgill.sable.soot.jimple.*;
00041 
00042 public abstract class Predicate {
00043     protected static Jimple jimple = Jimple.v();
00044     protected Name name;
00045     protected Node node;
00046     protected Annotation annotation;
00047     protected Vector exceptions;
00048     protected PExp constraint;
00049     protected String description;
00050     protected boolean isStatic;
00051     protected boolean usePrivate;
00052     protected ClassOrInterfaceType type;
00053     protected Hashtable variablesUsed;
00054     protected Vector params;
00055     protected Vector paramTypes;
00056 /**
00057  * 
00058  * @param name edu.ksu.cis.bandera.jjjc.symboltable.Name
00059  * @param annotation edu.ksu.cis.bandera.annotation.Annotation
00060  * @param edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType type
00061  * @param node edu.ksu.cis.bandera.predicate.node.Node
00062  * @param exceptions java.util.Vector
00063  */
00064 protected Predicate(Name name, ClassOrInterfaceType type, Annotation annotation, Node node, Vector exceptions) throws DuplicatePredicateException {
00065     this.name = name;
00066     this.annotation = annotation;
00067     this.type = type;
00068     this.node = node;
00069     this.exceptions = exceptions;
00070 
00071     Name psName = name.getSuperName();
00072     try {
00073         PredicateSet ps = PredicateSet.getPredicateSet(psName);
00074         ps.putPredicate(this);
00075     } catch (Exception e) {
00076         PredicateSet ps = new PredicateSet(psName);
00077         ps.putPredicate(this);
00078         PredicateSet.putPredicateSet(ps);
00079     }
00080 }
00081 /**
00082  * 
00083  * @return edu.ksu.cis.bandera.annotation.Annotation
00084  */
00085 public edu.ksu.cis.bandera.annotation.Annotation getAnnotation() {
00086     return annotation;
00087 }
00088 /**
00089  * 
00090  * @return edu.ksu.cis.bandera.predicate.node.PExp
00091  */
00092 public edu.ksu.cis.bandera.specification.predicate.node.PExp getConstraint() {
00093     return constraint;
00094 }
00095 /**
00096  * 
00097  * @return java.lang.String
00098  */
00099 public java.lang.String getDescription() {
00100     return description;
00101 }
00102 /**
00103  * 
00104  * @return java.util.Vector
00105  */
00106 public java.util.Vector getExceptions() {
00107     return exceptions;
00108 }
00109 /**
00110  * 
00111  * @return edu.ksu.cis.bandera.jjjc.symboltable.Name
00112  */
00113 public Name getName() {
00114     return name;
00115 }
00116     public Node getNode() { return node; /* robbyjo's patch */ }
00117 /**
00118  * 
00119  * @return int
00120  */
00121 public int getNumOfParams() {
00122     return params.size();
00123 }
00124 /**
00125  * 
00126  * @return java.lang.String
00127  * @param index int
00128  */
00129 public String getParam(int index) {
00130     return (String) params.elementAt(index);
00131 }
00132 /**
00133  * 
00134  * @return java.util.Vector
00135  */
00136 public java.util.Vector getParams() {
00137     return params;
00138 }
00139 /**
00140  * 
00141  * @return edu.ksu.cis.bandera.jjjc.symboltable.Type
00142  * @param index int
00143  */
00144 public Type getParamType(int index) {
00145     return (Type) paramTypes.elementAt(index);
00146 }
00147 /**
00148  * 
00149  * @return java.util.Vector
00150  */
00151 public java.util.Vector getParamTypes() {
00152     return paramTypes;
00153 }
00154 /**
00155  * 
00156  * @return edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType
00157  */
00158 public edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType getType() {
00159     return type;
00160 }
00161 /**
00162  * 
00163  * @return java.util.Hashtable
00164  */
00165 public java.util.Hashtable getVariablesUsed() {
00166     return variablesUsed;
00167 }
00168 /**
00169  * 
00170  * @return boolean
00171  */
00172 public boolean isStatic() {
00173     return isStatic;
00174 }
00175 /**
00176  * 
00177  * @return boolean
00178  */
00179 public boolean isUsePrivate() {
00180     return usePrivate;
00181 }
00182 /**
00183  * 
00184  * @return boolean
00185  */
00186 public boolean isValid() {
00187     return exceptions.size() == 0;
00188 }
00189 /**
00190  * 
00191  * @param newConstraint edu.ksu.cis.bandera.specification.predicate.node.PExp
00192  */
00193 public void setConstraint(edu.ksu.cis.bandera.specification.predicate.node.PExp newConstraint) {
00194     constraint = newConstraint;
00195 }
00196 /**
00197  * 
00198  * @param newDescription java.lang.String
00199  */
00200 public void setDescription(java.lang.String newDescription) {
00201     description = newDescription.toString();
00202     if ("".equals(description)) {
00203         description = null;
00204     }
00205 }
00206 /**
00207  * 
00208  * @param newParams java.util.Vector
00209  */
00210 public void setParams(java.util.Vector newParams) {
00211     params = newParams;
00212 }
00213 /**
00214  * 
00215  * @param newParamTypes java.util.Vector
00216  */
00217 public void setParamTypes(java.util.Vector newParamTypes) {
00218     paramTypes = newParamTypes;
00219 }
00220 /**
00221  * 
00222  * @param newIsStatic boolean
00223  */
00224 public void setStatic(boolean isStatic) {
00225     this.isStatic = isStatic;
00226 }
00227 /**
00228  * 
00229  * @param newType edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType
00230  */
00231 public void setType(edu.ksu.cis.bandera.jjjc.symboltable.ClassOrInterfaceType newType) {
00232     type = newType;
00233 }
00234 /**
00235  * 
00236  * @param newUsePrivate boolean
00237  */
00238 public void setUsePrivate(boolean newUsePrivate) {
00239     usePrivate = newUsePrivate;
00240 }
00241 /**
00242  * 
00243  * @param newVariablesUsed java.util.Hashtable
00244  */
00245 public void setVariablesUsed(java.util.Hashtable newVariablesUsed) {
00246     variablesUsed = newVariablesUsed;
00247 }
00248 }

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